From 187aab914f7dfd419ba17bae92318e259cf19628 Mon Sep 17 00:00:00 2001 From: 29iduser <you@example.com> Date: Tue, 25 Oct 2022 10:40:48 -0500 Subject: [PATCH] debug --- iexcode/instruments/utilities.py | 10 ----- iexcode/macros/start_of_the_week.py | 59 ++++++++++++++++++++--------- requirements.txt | 2 + 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/iexcode/instruments/utilities.py b/iexcode/instruments/utilities.py index 64a0beb..b731ba6 100644 --- a/iexcode/instruments/utilities.py +++ b/iexcode/instruments/utilities.py @@ -70,16 +70,6 @@ def input_timeout(question,t): else: print("You said nothing!") -def playsound(sound='FF'): - """ - 'FF' Final Fantasy victory sound - 'ding' a subtle ding noise - 'hallelujah' hallelujah chorus - 'train' train whistle - 'drumroll' - 'beepboop - """ - play_sound(sound) def play_sound(sound='train'): """ diff --git a/iexcode/macros/start_of_the_week.py b/iexcode/macros/start_of_the_week.py index cebb725..d504148 100644 --- a/iexcode/macros/start_of_the_week.py +++ b/iexcode/macros/start_of_the_week.py @@ -22,6 +22,23 @@ global m3r_camNum m3r_camNum = 6 def sotw(grt,branch,wait=False,**kwarg): + """ This should be run every at the start of every week. + If wait=True, wait for next day a 8:05. + + **kwargs: + mode: polarization, default => RCP + repeat: True/False + True => doesn't do any initialization + False => resets everything (switches branch and grating) + scanType = ['slit1','wire','monoVslit','flux',] + sound: plays sound when a scantype is completed, default => True + + # for individiual scantypes + slit1A_extended: to take a larger range, default => False + monoVslit_quick: + True => takes a single line cut (default) + False => """ + StartOfTheWeek(grt,branch,wait=wait,**kwarg) def default_detectors(branch): @@ -54,7 +71,9 @@ def interactive_fct(): if flag == '1': print('\nresuming script...\n') if flag == '2': - print('\nrepeating scan...\n') + print('\nrepeating scan...\n') + if flag == '': + return return flag def input2float(ask,default_x=0): @@ -129,6 +148,8 @@ def interactive_fit_mda(val_name,scannum,det,FWHM_or_PolyOrder,fct,**kwargs): position = fit_mda(scannum,det,FWHM_or_PolyOrder,fct,xrange=(x1,x2)) plt.show() flagfit=2 + if flatfit == '': + return return flagfit,position def sotw_BLinit(branch): @@ -215,11 +236,11 @@ def sotw_ID_steering(detCA4,**kwargs): scanNum_v = last_mda() flagfit, h = interactive_fit_mda('H_center',scanNum_h,detCA4,1,'gauss',xrange=[-1,1]) - if flagfit == '': + if flagfit == '' or flag <0: return flagfit, v = interactive_fit_mda('V_center',scanNum_v,detCA4,1,'gauss',xrange=[-1,1]) - if flagfit == '': + if flagfit == '' or flag <0: return try: ID_steering_message(h,v) @@ -298,22 +319,24 @@ def sotw_slit_vs_mono(slit_name,**kwargs): FMB_mirror_move(1,'RZ',new_roll) sleep(2) FMB_mirror_get(1) - print('\nrepeating scans...') + + #update M1 dictionary + foo=input('Do you want to update the M1 (y or n)? >') + if foo[0].lower() == 'y': + try: + #update_mirror_dict(1) + print_warning_message("need to debug update_mirror_dict, do by hand") + except: + print_warning_message("couldn't update the mirror dictionary, do by hand") + if flag == '': + return flag == 2 except: print('\invalid input; unable to move M1') - flag = interactive_fct() + flag = interactive_fct() + print('\nrepeating scans...') + - #update M1 dictionary - foo=input('Do you want to update the M1 (y or n)? >') - if foo[0].lower() == 'y': - try: - #update_mirror_dict(1) - print_warning_message("need to debug update_mirror_dict, do by hand") - except: - print_warning_message("couldn't update the mirror dictionary, do by hand") - if flag == '': - return return flag,v,h @@ -428,7 +451,7 @@ def StartOfTheWeek(grt,branch,wait=False,**kwargs): flag=2 while flag>1: flag = sotw_ID_steering(detCA4,**kwargs) - if flag == '': + if flag == '' or flag <0: return diagnostic('mesh_W','out') @@ -437,7 +460,7 @@ def StartOfTheWeek(grt,branch,wait=False,**kwargs): if 'wire' in kwargs['scanType']: print("\n\n================== Slit 1A scans:") flag = sotw_wire(detH,detV,**kwargs) - if flag == '': + if flag == ''or flag <0: return ###### Mono/slit scans: @@ -454,7 +477,7 @@ def StartOfTheWeek(grt,branch,wait=False,**kwargs): print("\n\n================== Mono/slit scans:") flag =sotw_slit_positions(grt,**kwargs) - if flag == '': + if flag == '' or flag <0: return diff --git a/requirements.txt b/requirements.txt index 9621ae5..4ada736 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,5 @@ netCDF4 pyepics +playsound +#pygobject \ No newline at end of file -- GitLab