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

Conversation

mrakitin
Copy link
Member

This is a PR to add the startup files from the https://github.com/NSLS-II-XPD/profile_collection_ldrd20-31 repo to here, with updated numbering.

@mrakitin
Copy link
Member Author

I think it worked OK. We'll merge the qserver-related changes from the https://github.com/NSLS-II-XPD/profile_collection/tree/minimal branch via a separate PR.

@mrakitin
Copy link
Member Author

I think we should keep this PR branch separate from master as the listed equipment will be added and removed, so it may not be compatible with the main setup all the time. Maybe we could add checks if the devices are connected and then use them in the namespace.

Copy link
Member Author

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really need to apply black/isort formatting to this repo and enforce it via CI on every commit. Let's do it in a separate PR after this PR is merged (assuming we can use it with and without portable equipment).

Some suggestions are below meanwhile.

tiled_client = from_profile("xpd-ldrd20-31")
except (NameError, ModuleNotFoundError):
pass
qepro = QEPro('XF:28ID2-ES{QEPro:Spec-1}:', name='QEPro', )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: make instantiation conditional based on the fact is the equipment is at the beamline or not. try..except will work.


try:
from tiled.client import from_profile
tiled_client = from_profile("xpd-ldrd20-31")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cheng-hung, do we need it here? Are you using it elsewhere? We probably should move it to 00-startup.py.

Comment on lines +54 to +56



Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +85 to +87



Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +416 to +418



Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +524 to +562
dds1 = syrng_DDS('XF:28IDC-ES:1{Pump:Syrng-DDS:1', name='DDS1')

dds1_p1 = syrng_DDS_ax('XF:28IDC-ES:1{Pump:Syrng-DDS:1-Ax:A}', name='DDS1_p1', parent=dds1,
read_attrs=['status',
'read_target_vol', 'read_target_vol_unit',
'read_infused', 'read_infused_unit',
'read_withdrawn', 'read_withdrawn_unit',
'read_infuse_rate', 'read_infuse_rate_unit',
'read_withdraw_rate', 'read_withdraw_rate_unit'])

dds1_p2 = syrng_DDS_ax('XF:28IDC-ES:1{Pump:Syrng-DDS:1-Ax:B}', name='DDS1_p2', parent=dds1,
read_attrs=['status',
'read_target_vol', 'read_target_vol_unit',
'read_infused', 'read_infused_unit',
'read_withdrawn', 'read_withdrawn_unit',
'read_infuse_rate', 'read_infuse_rate_unit',
'read_withdraw_rate', 'read_withdraw_rate_unit'])




dds2 = syrng_DDS('XF:28IDC-ES:1{Pump:Syrng-DDS:2', name='DDS2')

dds2_p1 = syrng_DDS_ax('XF:28IDC-ES:1{Pump:Syrng-DDS:2-Ax:A}', name='DDS2_p1', parent=dds2,
read_attrs=['status',
'read_target_vol', 'read_target_vol_unit',
'read_infused', 'read_infused_unit',
'read_withdrawn', 'read_withdrawn_unit',
'read_infuse_rate', 'read_infuse_rate_unit',
'read_withdraw_rate', 'read_withdraw_rate_unit'])

dds2_p2 = syrng_DDS_ax('XF:28IDC-ES:1{Pump:Syrng-DDS:2-Ax:B}', name='DDS2_p2', parent=dds2,
read_attrs=['status',
'read_target_vol', 'read_target_vol_unit',
'read_infused', 'read_infused_unit',
'read_withdrawn', 'read_withdrawn_unit',
'read_infuse_rate', 'read_infuse_rate_unit',
'read_withdraw_rate', 'read_withdraw_rate_unit'])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these devices should be instantiated conditionally.

Comment on lines +8 to +18
LED = EpicsSignal('XF:28IDC-ES:1{Light:Flu-LED:1}Cmd', name='LED_M365LP1', string=True, kind='hinted')
# 0: 'Low'; 1: 'High'

deuterium = EpicsSignal('XF:28IDC-ES:1{Light:Abs-Dut:1}Cmd', name='Deuterium', string=True, kind='Config')
# 0: 'Low'; 1: 'High'

halogen = EpicsSignal('XF:28IDC-ES:1{Light:Abs-Hal:1}Cmd', name='Halogen', string=True, kind='Config')
# 0: 'Low'; 1: 'High'

UV_shutter = EpicsSignal('XF:28IDC-ES:1{Light:Abs-Sht:1}Cmd', name='UV_shutter', string=True, kind='hinted')
# 0: 'Low' --> shutter close.; 1: 'High' --> Shutter open.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditional instantiation, please.




def _exprot_rate_agent(metadata_dic, rate_label_dic, agent_data):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _exprot_rate_agent(metadata_dic, rate_label_dic, agent_data):
def _export_rate_agent(metadata_dic, rate_label_dic, agent_data):

Check where it's used and fix the name there as well.

plt.figure(num=i)


class plot_uvvis(open_figures):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class name should use the PascalCase style.

Suggested change
class plot_uvvis(open_figures):
class PlotUvvis(open_figures):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All classes' names in this module should be corrected. See https://peps.python.org/pep-0008/#class-names for guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants