Post beamtime cleanup

This commit is contained in:
2023-03-15 13:54:26 +01:00
parent 88884f73ae
commit 24a2a465c5
19 changed files with 459 additions and 93 deletions

View File

@ -5,15 +5,16 @@ logger = logging.getLogger("slic")
logger.setLevel(logging.INFO)
logger.info("Loading started.")
# create file handler which logs
fh = logging.FileHandler('/sf/cristallina/applications/slic/cristallina/log/cristallina.log')
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)
from time import sleep
from datetime import datetime
import numpy as np
import sys
import os
os.chdir('/sf/cristallina/applications/slic/cristallina')
# from tqdm import trange
from epics import PV
from alignment_laser import AlignmentLaser
@ -22,18 +23,16 @@ from slic.core.adjustable import Adjustable, PVAdjustable, DummyAdjustable
from slic.core.acquisition import SFAcquisition, PVAcquisition
from slic.core.condition import PVCondition
from slic.core.scanner import Scanner
from slic.core.device.simpledevice import SimpleDevice
from slic.devices.xdiagnostics.intensitymonitor import IntensityMonitorPBPS
from slic.devices.general.motor import Motor
from slic.devices.general.shutter import Shutter
from slic.devices.xoptics.pulsepicker import PulsePicker
from slic.utils import devices, Marker, as_shortcut
from slic.utils import Channels, Config, Elog, Screenshot, PV
from slic.core.acquisition.fakeacquisition import FakeAcquisition
from slic.devices.timing.events import CTASequencer
from bs_channels import detectors, bs_channels
from bs_channels import detectors, bs_channels, camera_channels
from pv_channels import pvs
from spreadsheet import overview
from channels_minimal import detectors_min, channels_min, pvs_min
@ -42,17 +41,15 @@ from pp_shutter import PP_Shutter
# DEVICES
## example devices and adjustables
from cool_motor import MyNewCoolThing
cool_motor = MyNewCoolThing("cool_motor")
dummy = DummyAdjustable(units="au")
## Attenuators
# Attenuators
from slic.devices.xoptics.aramis_attenuator import Attenuator
from knife_edge import KnifeEdge
from standa import standa
standa = standa
Newport_large = Motor("SARES30-MOBI1:MOT_5")
attenuator = Attenuator("SAROP31-OATA150", description="Cristallina attenuator OATA150")
front_end_attenuator = Attenuator("SARFE10-OATT053", description="Front end attenuator OATT053")
cta = CTASequencer("SAR-CCTA-ESC")
@ -85,27 +82,25 @@ import undulator
undulators = undulator.Undulators()
# Shutter
shutter = PP_Shutter("SARES30-LTIM01-EVR0:RearUniv0-Ena-SP",name="Cristallina pulse picker shutter") # Shutter buttton when using the pulse picker
shutter = PP_Shutter("SARES30-LTIM01-EVR0:RearUniv0-Ena-SP", name="Cristallina pulse picker shutter") # Shutter buttton when using the pulse picker
pulsepicker = PulsePicker("SAROP31-OPPI151","SARES30-LTIM01-EVR0:Pul3", name="Cristallina X-ray pulse picker OPPI151")
# Alignmnet laser
alaser = AlignmentLaser("SAROP31-OLAS147:MOTOR_1",name="Cristallina alignment laser OLAS147")
alaser = AlignmentLaser("SAROP31-OLAS147:MOTOR_1", name="Cristallina alignment laser OLAS147")
## Slits
from slic.devices.xoptics import slits
## Smaract & attocube stages
from smaract_device_def import smaract
from smaract_device_def import smaract_Juraj, smaract_mini_XYZ
from attocube_device_def import attocube
# KBs
from slic.devices.xoptics.kb import KBBase,KBHor,KBVer
from slic.devices.xoptics.kb import KBHor,KBVer
kbHor = KBHor(
"SAROP31-OKBH154",
description="Cristallina horizontal KB mirror"
)
kbVer = KBVer(
"SAROP31-OKBV153",
description="Cristallina vertical KB mirror"
@ -122,7 +117,10 @@ instrument = "cristallina"
# pgroup = "p20557" # CrQ PMS commisioning 1
# pgroup = "p20509" # CrQ commissoing DilSc1
# pgroup = "p20519" # beamline commissioning 2
pgroup = "p20841" # CrQ PMS commisioning 2 (Jan 2023)
# pgroup = "p20840" # Cr beamline commisioning (Jan-Feb 2023)
# pgroup = "p20841" # CrQ PMS commisioning 2 (Jan 2023)
pgroup = "p20993" # CrQ commissoing DilSc2 (March 2023)
# pgroup = "p19150" # Scratch
# pgroup = "p19152" # Scratch
@ -141,7 +139,7 @@ daq = SFAcquisition(
# scan = Scanner(scan_info_dir=f"/sf/{instrument}/data/{pgroup}/res/scan_info", default_acquisitions=[daq], condition=None)
# Run the scan only when gas monitor value larger than 10uJ (and smaller than 2000uJ):
check_intensity_gas_monitor = PVCondition("SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US", vmin=10, vmax=2000, wait_time=0.5, required_fraction=0.8) # required fraction defines ammount of data recorded to save the step and move on to the next one
check_intensity_gas_monitor = PVCondition("SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US", vmin=0.1, vmax=2000, wait_time=0.5, required_fraction=0.8) # required fraction defines ammount of data recorded to save the step and move on to the next one
scan = Scanner(default_acquisitions=[daq],condition = check_intensity_gas_monitor)
gui = GUI(scan, show_goto=True, show_spec=True)
@ -172,6 +170,7 @@ def pulse(run_comment=None):
# Data retrieval does not allow empty list, so creating a new variable
if detectors == [] or detectors == None:
used_detectors = {}
else:
used_detectors = detectors
@ -182,7 +181,7 @@ def pulse(run_comment=None):
run_number = sf_daq_client.retrieve_data_from_buffer(pgroup=pgroup, user_tag=run_comment,
camera_channels=[], bsread_channels=bs_channels, epics_channels=pvs,
detectors=used_detectors,
start_pulseid=start_PID-90, stop_pulseid=start_PID+20,
start_pulseid=start_PID-10, stop_pulseid=start_PID+210,
rate_multiplicator=1,
)
print('\n')