-
Notifications
You must be signed in to change notification settings - Fork 5
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
More user functions and improvements #94
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -34,7 +34,17 @@ def ct_dark_all_patch(frames=None): | |||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def pol_L(pol, epu_cal_offset=None, epu_table_number=None): | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
"""A helper bluesky plan to change vertical and horizontal poloarization | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
Parameters: | ||||||||||||||||||||||||||
----------- | ||||||||||||||||||||||||||
pol : string | ||||||||||||||||||||||||||
'H' or 'V' for horizontal (epu phase = 0) or vertical (epu phase = 24.6) polarization for CSX's undulator | ||||||||||||||||||||||||||
epu_cal_offset : float | ||||||||||||||||||||||||||
offset to tune the precice epu gap for a paricular energy using a particular epu calibration table | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
epu_table_number : int | ||||||||||||||||||||||||||
epu calibration table | ||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
current_E = pgm.energy.setpoint.get() | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
@@ -59,7 +69,7 @@ def pol_L(pol, epu_cal_offset=None, epu_table_number=None): | |||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
yield from bps.mv(diag6_pid.enable,1) # finepitch feedback ON | ||||||||||||||||||||||||||
yield from bps.sleep(1) | ||||||||||||||||||||||||||
yield from bps.sleep(0.1) | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sleeps frighten me, although less so to see an existing one reduced, is there something this is waiting on? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can reduce the time because we are able to run the diag6 prosilica much faster. diag6_pid is the pid loop that keeps the m1 finepitch under constant control to keep the beam on the exit slit. There could be some instability in the beginning of the feedback loop when we turn it back on. The sleep is to allow that instability to happen without letting the user collect data. the daig6_pid knows nothing about the output error that is running at dt = 0.005 seconds or faster. |
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def pol_C(pol, epu_cal_offset=-267, epu_phase=None): | ||||||||||||||||||||||||||
'''This circular polarization change uses the horizontal polarization table and will force this table. | ||||||||||||||||||||||||||
|
@@ -112,7 +122,15 @@ def md_info(default_md = RE.md): | |||||||||||||||||||||||||
print(f' {info:_<30} : {val}') | ||||||||||||||||||||||||||
print('\n\n Use \'md_info()\' or \'RE.md\' to inspect again.') | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def mvslt3(size=None): #TODO make a better version for slt3.pinhole child | ||||||||||||||||||||||||||
def mvslt3(size=None): #TODO make a better version for slt3.pinhole child | ||||||||||||||||||||||||||
"""A helper bluesky plan to move to different pinhole diameters for slit 3. | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
Parameters: | ||||||||||||||||||||||||||
----------- | ||||||||||||||||||||||||||
size : int | ||||||||||||||||||||||||||
pinhole size in microns. options are 2000, 50, 20, and 10. if None, then the current pinhole is returned. | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||
#x Mtr.OFF = 4.88, y Mtr.OFF = -0.95 | ||||||||||||||||||||||||||
holes = {2000: ( 8.800, 0.000), #TODO eventually have IOC to track these values | ||||||||||||||||||||||||||
50: ( 0.000, 0.000), | ||||||||||||||||||||||||||
|
@@ -166,3 +184,19 @@ def wait_for_peaks(pool_interval, timeout, peaks, peaks_fields=None): | |||||||||||||||||||||||||
break | ||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||
yield from bps.sleep(pool_interval) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def _block_beam(block_beam_bit): ##TODO move this to a child of inout | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
if block_beam_bit: | ||||||||||||||||||||||||||
if inout.status.get() =="Not Inserted": | ||||||||||||||||||||||||||
yield from mv(inout, "In") | ||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||
if inout.status.get() =="Inserted": | ||||||||||||||||||||||||||
yield from mv(inout, "Out") | ||||||||||||||||||||||||||
Comment on lines
+189
to
+194
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def block_beam(): | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The alias info might be difficult to keep consistent with future changes. Consider moving that info to a comment where the aliases are defined.
Suggested change
|
||||||||||||||||||||||||||
yield from _block_beam(1) | ||||||||||||||||||||||||||
def show_beam(): | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
yield from _block_beam(0) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
beam_block = block_beam | ||||||||||||||||||||||||||
beam_show = show_beam | ||||||||||||||||||||||||||
Comment on lines
+201
to
+202
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -35,13 +35,16 @@ | |||||||
# getattr(sclr.channels, f'chan{i}').kind = 'normal' will remove the | ||||||||
# hinted fields from LivePlot and LiveTable. | ||||||||
|
||||||||
|
||||||||
|
||||||||
def relabel_fig(fig, new_label): | ||||||||
fig.set_label(new_label) | ||||||||
fig.canvas.manager.set_window_title(fig.get_label()) | ||||||||
|
||||||||
# fccd.hints = {'fields': ['fccd_stats1_total']} | ||||||||
for i in [1, 2, 3, 4, 5]: | ||||||||
getattr(fccd, f'stats{i}').total.kind = 'hinted' | ||||||||
fccd.mcs.read_attrs = fccd.mcs.read_attrs[0:7] #silences the channels we do not use (7-32) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pre-line comments are generally easier to read when they are more than 1-2 words.
Suggested change
|
||||||||
|
||||||||
# cam_dif.hints = {'fields' : ['cam_dif_stats3_total','cam_dif_stats1_total']} | ||||||||
for i in [1, 3]: | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.