|
|
|
@ -9,8 +9,8 @@ os.chdir("/sf/cristallina/applications/slic/cristallina")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setup_general_logging():
|
|
|
|
|
""" Setup logging to console and files in both the snapshots and
|
|
|
|
|
the respective pgroup.
|
|
|
|
|
"""Setup logging to console and files in both the snapshots and
|
|
|
|
|
the respective pgroup.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
logger.remove()
|
|
|
|
@ -34,6 +34,7 @@ def setup_general_logging():
|
|
|
|
|
logger.warning("Cannot write log file to snapshots.")
|
|
|
|
|
logger.warning(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setup_logging_pgroup(pgroup, level="INFO"):
|
|
|
|
|
try:
|
|
|
|
|
logger.add(
|
|
|
|
@ -68,14 +69,13 @@ from slic.core.acquisition.fakeacquisition import FakeAcquisition
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from channels.bs_channels import (
|
|
|
|
|
detectors,
|
|
|
|
|
detectors,
|
|
|
|
|
detectors_MX,
|
|
|
|
|
bs_channels,
|
|
|
|
|
camera_channels,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from channels.pv_channels import pvs
|
|
|
|
|
from channels.pv_channels import pv_channels
|
|
|
|
|
from spreadsheet import overview
|
|
|
|
|
|
|
|
|
|
# from channels_minimal import detectors_min, channels_min, pvs_min
|
|
|
|
@ -85,12 +85,20 @@ from spreadsheet import overview
|
|
|
|
|
dummy = DummyAdjustable(units="au")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#from devices.knife_edge import KnifeEdge
|
|
|
|
|
#from devices.standa import standa
|
|
|
|
|
#from devices.newport import newport
|
|
|
|
|
# from devices.knife_edge import KnifeEdge
|
|
|
|
|
# from devices.standa import standa
|
|
|
|
|
# from devices.newport import newport
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from beamline.components import upstream_attenuator, attenuator, shutter, pulsepicker, front_end_attenuator
|
|
|
|
|
from beamline.components import (
|
|
|
|
|
upstream_attenuator,
|
|
|
|
|
attenuator,
|
|
|
|
|
pp_shutter,
|
|
|
|
|
pulsepicker,
|
|
|
|
|
alignment_laser,
|
|
|
|
|
pbps113,
|
|
|
|
|
pbps149,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from beamline.components import kbHor, kbVer
|
|
|
|
|
|
|
|
|
@ -99,24 +107,11 @@ from systems.components import cta
|
|
|
|
|
from gp_exp.components import Newport_large, OWIS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_attenuator():
|
|
|
|
|
tfundamental = attenuator.get_transmission()
|
|
|
|
|
try:
|
|
|
|
|
assert tfundamental > 0
|
|
|
|
|
except TypeError:
|
|
|
|
|
logger.warning("No transmission value reported from {attenuator.ID}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_attenuator()
|
|
|
|
|
|
|
|
|
|
# Undulators
|
|
|
|
|
from beamline import undulator
|
|
|
|
|
|
|
|
|
|
undulators = undulator.Undulators()
|
|
|
|
|
logger.info(
|
|
|
|
|
f"Using undulator (Aramis) offset to PSSS energy of {undulator.energy_offset} eV."
|
|
|
|
|
)
|
|
|
|
|
logger.info(f"Using undulator (Aramis) offset to PSSS energy of {undulator.energy_offset} eV.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Slits
|
|
|
|
@ -139,6 +134,7 @@ diffractometer = Diffractometer("diffractometer")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from crq_exp.dilsc import Dilution
|
|
|
|
|
|
|
|
|
|
dilution = Dilution()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -149,28 +145,27 @@ from slic.core.acquisition.spreadsheet import Spreadsheet
|
|
|
|
|
|
|
|
|
|
# setup spreadsheet for transmission to stand
|
|
|
|
|
spreadsheet = Spreadsheet(
|
|
|
|
|
{
|
|
|
|
|
"Transmission" : attenuator.trans1st,
|
|
|
|
|
"Upstream Transmission": upstream_attenuator.trans1st,
|
|
|
|
|
"Energy_setpoint" : undulators,
|
|
|
|
|
"Energy_offset": undulator.energy_offset,
|
|
|
|
|
"TD": diffractometer.td,
|
|
|
|
|
"TRX": diffractometer.tr_x,
|
|
|
|
|
"TRY": diffractometer.tr_y,
|
|
|
|
|
"TRXBASE": diffractometer.trx_base,
|
|
|
|
|
"TRYBASE": diffractometer.try_base,
|
|
|
|
|
"THETA": diffractometer.theta,
|
|
|
|
|
"TWOTHETA": diffractometer.twotheta,
|
|
|
|
|
"Magnet_X": dilution.x,
|
|
|
|
|
"Magnet_Y": dilution.y,
|
|
|
|
|
"Magnet_Z": dilution.z,
|
|
|
|
|
"DilSc_T_plato": dilution.T_plato,
|
|
|
|
|
"DilSc_T_pucksensor": dilution.T_pucksensor,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
placeholders=("comment", "sample", "run_usable"),
|
|
|
|
|
host="saresc-vcons-02.psi.ch",
|
|
|
|
|
port=9090,
|
|
|
|
|
{
|
|
|
|
|
"Transmission": attenuator.trans1st,
|
|
|
|
|
"Upstream Transmission": upstream_attenuator.trans1st,
|
|
|
|
|
"Energy_setpoint": undulators,
|
|
|
|
|
"Energy_offset": undulator.energy_offset,
|
|
|
|
|
"TD": diffractometer.td,
|
|
|
|
|
"TRX": diffractometer.tr_x,
|
|
|
|
|
"TRY": diffractometer.tr_y,
|
|
|
|
|
"TRXBASE": diffractometer.trx_base,
|
|
|
|
|
"TRYBASE": diffractometer.try_base,
|
|
|
|
|
"THETA": diffractometer.theta,
|
|
|
|
|
"TWOTHETA": diffractometer.twotheta,
|
|
|
|
|
"Magnet_X": dilution.x,
|
|
|
|
|
"Magnet_Y": dilution.y,
|
|
|
|
|
"Magnet_Z": dilution.z,
|
|
|
|
|
"DilSc_T_plato": dilution.T_plato,
|
|
|
|
|
"DilSc_T_pucksensor": dilution.T_pucksensor,
|
|
|
|
|
},
|
|
|
|
|
placeholders=("comment", "sample", "run_usable"),
|
|
|
|
|
host="saresc-vcons-02.psi.ch",
|
|
|
|
|
port=9090,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
@ -183,7 +178,7 @@ try:
|
|
|
|
|
except Exception as error:
|
|
|
|
|
# catching excpetions with a broad net because different connection errors can occur.
|
|
|
|
|
logger.warning(f"Cannot connect to stand server on {stand_host}. Disabling spreadsheet.")
|
|
|
|
|
spreadsheet = None
|
|
|
|
|
spreadsheet = None
|
|
|
|
|
|
|
|
|
|
# spreadsheet = Spreadsheet(adjs, placeholders=PLACEHOLDERS, host="127.0.0.1", port=8080))
|
|
|
|
|
|
|
|
|
@ -200,7 +195,7 @@ daq = SFAcquisition(
|
|
|
|
|
instrument,
|
|
|
|
|
pgroup,
|
|
|
|
|
default_channels=bs_channels,
|
|
|
|
|
default_pvs=pvs,
|
|
|
|
|
default_pvs=pv_channels,
|
|
|
|
|
default_detectors=detectors,
|
|
|
|
|
rate_multiplicator=1,
|
|
|
|
|
spreadsheet=spreadsheet,
|
|
|
|
@ -212,7 +207,7 @@ daq.update_config_pvs()
|
|
|
|
|
|
|
|
|
|
from acquisition import multiple_daqs
|
|
|
|
|
|
|
|
|
|
DAQS = multiple_daqs.generate_DAQS(instrument, pgroup,bs_channels, pvs, detectors, spreadsheet)
|
|
|
|
|
DAQS = multiple_daqs.generate_DAQS(instrument, pgroup, bs_channels, pv_channels, detectors, spreadsheet)
|
|
|
|
|
|
|
|
|
|
# daq_fake = FakeAcquisition(instrument, pgroup)
|
|
|
|
|
# daq_PV_only = PVAcquisition(instrument, pgroup, default_channels=channels_ks) # workaround for KS not going to DB
|
|
|
|
|