Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine collection and ldrd20-31 profiles to use with blop #12

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
We need to generate `integration` files and tiff files (`dark_sub`)

What we have now via Kafka:

```bash
2024-05-28/20:20:49 mrakitin@xf28id2-ws3:XPD (RHEL8.9) /nsls2/data/xpd-new/proposals/commissioning/pass-315985/ldrd/unnamed_sample $ tree
.
├── fq
│   └── unnamed_sample_20240528-202016_2f28e7_0001.fq
├── mask
├── meta
│   └── unnamed_sample_20240528-202016_2f28e7.yaml
├── pdf
│   └── unnamed_sample_20240528-202016_2f28e7_0001.gr
└── sq
└── unnamed_sample_20240528-202016_2f28e7_0001.sq
```


Good example (from ZMQ):

```bash
2024-05-28/20:24:59 mrakitin@xf28id2-ws3:XPD (RHEL8.9) /nsls2/data/xpd-new/proposals/commissioning/pass-315985/tmp/unnamed_sample $ tree .
.
├── dark_sub
│   ├── unnamed_sample_20240517-184225_2f003e_primary-dk_sub_image-00000.tiff
│   └── unnamed_sample_20240528-191335_29af22_primary-dk_sub_image-00000.tiff
├── fq
│   ├── unnamed_sample_20240528-183014_ca6f1a_0001.fq
│   ├── unnamed_sample_20240528-185345_79aec5_0001.fq
│   ├── unnamed_sample_20240528-185612_15c0fd_0001.fq
│   ├── unnamed_sample_20240528-190023_c55fbd_0001.fq
│   ├── unnamed_sample_20240528-191335_29af22_0001.fq
│   └── unnamed_sample_20240528-201210_786aad_0001.fq
├── integration
│   ├── unnamed_sample_20240528-191335_29af22_primary-1_mean_q.chi
│   └── unnamed_sample_20240528-191335_29af22_primary-1_mean_tth.chi
├── mask
│   ├── unnamed_sample_20240517-184225_2f003e_primary-mask-1.npy
│   └── unnamed_sample_20240528-191335_29af22_primary-mask-1.npy
├── meta
│   ├── unnamed_sample_20240517-184225_2f003e.yaml
│   ├── unnamed_sample_20240528-191335_29af22.yaml
│   └── unnamed_sample_20240528-201210_786aad.yaml
├── pdf
│   ├── unnamed_sample_20240528-183014_ca6f1a_0001.gr
│   ├── unnamed_sample_20240528-185345_79aec5_0001.gr
│   ├── unnamed_sample_20240528-185612_15c0fd_0001.gr
│   ├── unnamed_sample_20240528-190023_c55fbd_0001.gr
│   ├── unnamed_sample_20240528-191335_29af22_0001.gr
│   └── unnamed_sample_20240528-201210_786aad_0001.gr
├── scalar_data
│   ├── unnamed_sample_20240517-184225_2f003e_primary.csv
│   └── unnamed_sample_20240528-191335_29af22_primary.csv
└── sq
├── unnamed_sample_20240528-183014_ca6f1a_0001.sq
├── unnamed_sample_20240528-185345_79aec5_0001.sq
├── unnamed_sample_20240528-185612_15c0fd_0001.sq
├── unnamed_sample_20240528-190023_c55fbd_0001.sq
├── unnamed_sample_20240528-191335_29af22_0001.sq
└── unnamed_sample_20240528-201210_786aad_0001.sq

8 directories, 29 files
```
15 changes: 15 additions & 0 deletions startup/00-startup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# Make ophyd listen to pyepics.
import nslsii
import ophyd.signal
import logging
from IPython import get_ipython

ip = get_ipython()

print(f"Loading {__file__} from {ip.profile_dir.startup_dir}.")

logger = logging.getLogger("startup_profile")

from bluesky_queueserver import is_re_worker_active

ophyd.signal.EpicsSignal.set_defaults(connection_timeout=5)
# See docstring for nslsii.configure_base() for more details
# this command takes away much of the boilerplate for settting up a profile
# (such as setting up best effort callbacks etc)

nslsii.configure_base(get_ipython().user_ns, 'xpd', pbar=True, bec=True,
magics=True, mpl=True, epics_context=False,
publish_documents_with_kafka=True)

del one_1d_step
del one_nd_step
del one_shot

# At the end of every run, verify that files were saved and
# print a confirmation message.
from bluesky.callbacks.broker import verify_files_saved, post_run
Expand Down
6 changes: 4 additions & 2 deletions startup/02-adaptive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Plan for running pgcam AE with a gradient TiCu sample."""
"""Plan for running gpcam AE with a gradient TiCu sample."""
import uuid
import itertools
import time
Expand Down Expand Up @@ -192,7 +192,7 @@ def adaptive_plan(
reccomender_timeout=1,
exposure=30,
max_runs=1,
take_data=rocking_ct,
take_data=None,
num=None,
rocking_range=2,
):
Expand Down Expand Up @@ -270,6 +270,8 @@ def snap(Ti, temperature, time):
it up for dead.

"""
if take_data is None:
take_data=rocking_ct

# unpack the real motors
x_motor, y_motor = real_motors
Expand Down
5 changes: 4 additions & 1 deletion startup/03-back_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ def batch_scan(
rocking_num=3,
real_motors,
exposure=20,
take_data=stepping_ct,
take_data=None,
transform_pair
):
if take_data is None:
take_data = stepping_ct

# unpack the real motors
x_motor, y_motor = real_motors
# make the soft pseudo axis
Expand Down
2 changes: 1 addition & 1 deletion startup/10-motors.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# RPI DIFFRACTOMETER motors ### Change th only after changing in other plans
th = EpicsMotor('XF:28IDC-ES:1{Dif:1-Ax:Th}Mtr', name='th')
tth = EpicsMotor('XF:28IDC-ES:1{Dif:1-Ax:2ThI}Mtr', name='tth')
#tth = EpicsMotor('XF:28IDC-ES:1{Dif:1-Ax:2ThI}Mtr', name='tth')
diff_x = EpicsMotor('XF:28IDC-ES:1{Dif:1-Ax:X}Mtr', name='diff_x')
diff_y = EpicsMotor('XF:28IDC-ES:1{Dif:1-Ax:Y}Mtr', name='diff_y')
diff_tth_i = EpicsMotor('XF:28IDC-ES:1{Dif:1-Ax:2ThI}Mtr', name='diff_tth_i')
Expand Down
48 changes: 28 additions & 20 deletions startup/1001-remoteplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,23 @@ def xpd_mscan_flt(sample_list, pos_list, ht_list, scanplan, motor=sample_x, dela
# -----start temperature scan plans ------------------

def xpd_temp_list(smpl, Temp_list, exp_time, delay=1, dets=[]):
'''
example
xpd_temp_list(1, [300, 350, 400], 5, delay=1)
sample 1, at temperature 300, 350 and 400, exposure time 5sec, wait 1 second after each temperature.
'''The plan to perform a scan over temperature list.

Parameters
----------

smpl: sample index ID in sample list
Temp_list: temperature list
exp_time : total exposure time for each sample, in seconds
delay: sleep time after each temperature changes, for temperature controller to stable
dets: list of motors, temperatures controllers, which will be recorded in table.

Examples
--------

parameters:
smpl: sample index ID in sample list
Temp_list: temperature list
exp_time : total exposure time for each sample, in seconds
delay: sleep time after each temperature changes, for temperature controller to stable
dets: list of motors, temperatures controllers, which will be recorded in table.
>>> xpd_temp_list(1, [300, 350, 400], 5, delay=1)

sample 1, at temperature 300, 350 and 400, exposure time 5sec, wait 1 second after each temperature.
'''
#RE(_configure_area_det(exp_time))
T_controller = xpd_configuration["temp_controller"]
Expand All @@ -193,16 +198,19 @@ def xpd_temp_list(smpl, Temp_list, exp_time, delay=1, dets=[]):

def xpd_temp_ramp(smpl, Tstart, Tstop, Tstep, exp_time, delay = 1, dets=[]):
'''
example:
xpd_temp_ramp(1, 300, 400, 10, 5, delay=1)
sample 1, from 300K to 400K, 10K steps, exposure time 5sec, wait 1 second after each temperature.

parameters:
smpl: sample index ID in sample list
Tstart, Tstop, Tstep: temperature range(Tstart, Tend), step size: Tstep
scanplan : scanplan index ID in scanplan list
delay: sleep time after each temperature changes, for temperature controller to stable
dets: list of motors, temperatures controllers, which will be recorded in table.
Parameters
----------
smpl: sample index ID in sample list
Tstart, Tstop, Tstep: temperature range(Tstart, Tend), step size: Tstep
scanplan : scanplan index ID in scanplan list
delay: sleep time after each temperature changes, for temperature controller to stable
dets: list of motors, temperatures controllers, which will be recorded in table.

Examples
--------
>>> xpd_temp_ramp(1, 300, 400, 10, 5, delay=1)

sample 1, from 300K to 400K, 10K steps, exposure time 5sec, wait 1 second after each temperature.
'''
#RE(_configure_area_det(exp_time))
T_controller = xpd_configuration["temp_controller"]
Expand Down
6 changes: 3 additions & 3 deletions startup/16-electrometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def set_primary(self, n, value=None):
cur.mean_value = Kind.hinted


# qem1 = XPDQuadEM("XF:28IDC-BI{IM:04}EM180:", name="qem1")
# for det in [qem1]:
# det.read_attrs = ['current2', 'current2.mean_value','current3', 'current3.mean_value']
qem1 = XPDQuadEM("XF:28IDC-BI{IM:02}EM180:", name="qem1")
for det in [qem1]:
det.read_attrs = ['current2', 'current2.mean_value','current3', 'current3.mean_value']
Loading