Loading autoreduce/PG3_OC_d55064_2023-02-15-HighRes_8mmCan_Test.h5→autoreduce/PG3_MAG-He3_d55064_2023-02-14.h5 (374 KiB) File changed and moved.No diff preview for this file type. View original file View changed file cal_config.json +3 −3 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ "Diamond": "/SNS/PG3/IPTS-2767/nexus/PG3_55064.nxs.h5", "RunCycle": "2023-1_11A_CAL", "Instrument": "PG3", "Date": "2023-02-15", "SampleEnv": "OC", "Notes": "HighRes_8mmCan_Test", "Date": "2023-02-14", "SampleEnv": "MAG-He3", "Notes": "ZYP", "OutputDir": "/SNS/PG3/shared/CALIBRATION/autoreduce", "PDCalibration": { "TofBinningFirst": "300,-0.0008,16667", Loading pg3_cal.py +44 −18 Original line number Diff line number Diff line Loading @@ -29,7 +29,11 @@ from Calibration.tofpd import diagnostics # ||||| Set-up session ||||| # vvvvv vvvvv # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ with open("cal_config.json", "r") as f: post_image = True cal_w_dir = "/SNS/PG3/shared/CALIBRATION" cal_config_f = os.path.join(cal_w_dir, "cal_config.json") with open(cal_config_f, "r") as f: cal_config = json.load(f) dia_file_name = os.path.basename(cal_config["Diamond"]) Loading Loading @@ -168,7 +172,10 @@ sam_env = cal_config["SampleEnv"] dia_name = f"d{dia_run_num}" date = cal_config["Date"] notes = cal_config["Notes"] if notes.strip() != "": cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}-{notes}.h5" else: cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}.h5" out_dir_1 = os.path.join(working_dir, cal_config["RunCycle"]) out_dir_2 = cal_config["OutputDir"] if working_dir not in out_dir_2: Loading Loading @@ -262,8 +269,6 @@ for det, mask in enumerate(mtd['_mask'].extractY()): max_all = np.nanmax(data) zmax_val = max_all / 10. html = "" fig, ax = plt.subplots() heatmap = ax.pcolormesh(data, cmap='viridis', vmax=zmax_val) colorbar = plt.colorbar(heatmap, ax=ax) Loading @@ -271,13 +276,26 @@ ax.set_xticks(np.arange(0, 350, 50), np.arange(0., 3.5, 0.5)) ax.set_xlabel('d-spacing') ax.set_ylabel('Detectors') diag_file_name = cal_file_name.replace(".h5", "_diag_1.png") diag_dir_1 = os.path.join(out_dir_1, "diagnostics") if not os.path.exists(diag_dir_1): os.makedirs(diag_dir_1) diag_dir_2 = os.path.join(out_dir_2, "diagnostics") if not os.path.exists(diag_dir_2): os.makedirs(diag_dir_2) diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') html_tmp = '<h4>Pixel-by-pixel line-up for diamond</h4>' html_tmp += '<img src=\'data:image/png;base64,{}\'>'.format(encoded) html += "<div>{}</div>".format(html_tmp) html = "<div>{}</div>".format(html_tmp) # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # ||||| Diagnostics-2 ||||| Loading @@ -286,6 +304,14 @@ html += "<div>{}</div>".format(html_tmp) fig, ax = diagnostics.difc_plot2d("_cal", "_cal_eng", instr_ws="_group", mask="_mask", vrange=(0, 5)) diag_file_name = cal_file_name.replace(".h5", "_diag_2.png") diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') Loading pg3_cal_dev.py→pg3_cal_local.py +44 −18 Original line number Diff line number Diff line Loading @@ -29,7 +29,11 @@ from Calibration.tofpd import diagnostics # ||||| Set-up session ||||| # vvvvv vvvvv # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ with open("cal_config.json", "r") as f: post_image = False cal_w_dir = "/SNS/PG3/shared/CALIBRATION" cal_config_f = os.path.join(cal_w_dir, "cal_config.json") with open(cal_config_f, "r") as f: cal_config = json.load(f) dia_file_name = os.path.basename(cal_config["Diamond"]) Loading Loading @@ -168,7 +172,10 @@ sam_env = cal_config["SampleEnv"] dia_name = f"d{dia_run_num}" date = cal_config["Date"] notes = cal_config["Notes"] if notes.strip() != "": cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}-{notes}.h5" else: cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}.h5" out_dir_1 = os.path.join(working_dir, cal_config["RunCycle"]) out_dir_2 = cal_config["OutputDir"] if working_dir not in out_dir_2: Loading Loading @@ -262,8 +269,6 @@ for det, mask in enumerate(mtd['_mask'].extractY()): max_all = np.nanmax(data) zmax_val = max_all / 10. html = "" fig, ax = plt.subplots() heatmap = ax.pcolormesh(data, cmap='viridis', vmax=zmax_val) colorbar = plt.colorbar(heatmap, ax=ax) Loading @@ -271,13 +276,26 @@ ax.set_xticks(np.arange(0, 350, 50), np.arange(0., 3.5, 0.5)) ax.set_xlabel('d-spacing') ax.set_ylabel('Detectors') diag_file_name = cal_file_name.replace(".h5", "_diag_1.png") diag_dir_1 = os.path.join(out_dir_1, "diagnostics") if not os.path.exists(diag_dir_1): os.makedirs(diag_dir_1) diag_dir_2 = os.path.join(out_dir_2, "diagnostics") if not os.path.exists(diag_dir_2): os.makedirs(diag_dir_2) diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') html_tmp = '<h4>Pixel-by-pixel line-up for diamond</h4>' html_tmp += '<img src=\'data:image/png;base64,{}\'>'.format(encoded) html += "<div>{}</div>".format(html_tmp) html = "<div>{}</div>".format(html_tmp) # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # ||||| Diagnostics-2 ||||| Loading @@ -286,6 +304,14 @@ html += "<div>{}</div>".format(html_tmp) fig, ax = diagnostics.difc_plot2d("_cal", "_cal_eng", instr_ws="_group", mask="_mask", vrange=(0, 5)) diag_file_name = cal_file_name.replace(".h5", "_diag_2.png") diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') Loading Loading
autoreduce/PG3_OC_d55064_2023-02-15-HighRes_8mmCan_Test.h5→autoreduce/PG3_MAG-He3_d55064_2023-02-14.h5 (374 KiB) File changed and moved.No diff preview for this file type. View original file View changed file
cal_config.json +3 −3 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ "Diamond": "/SNS/PG3/IPTS-2767/nexus/PG3_55064.nxs.h5", "RunCycle": "2023-1_11A_CAL", "Instrument": "PG3", "Date": "2023-02-15", "SampleEnv": "OC", "Notes": "HighRes_8mmCan_Test", "Date": "2023-02-14", "SampleEnv": "MAG-He3", "Notes": "ZYP", "OutputDir": "/SNS/PG3/shared/CALIBRATION/autoreduce", "PDCalibration": { "TofBinningFirst": "300,-0.0008,16667", Loading
pg3_cal.py +44 −18 Original line number Diff line number Diff line Loading @@ -29,7 +29,11 @@ from Calibration.tofpd import diagnostics # ||||| Set-up session ||||| # vvvvv vvvvv # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ with open("cal_config.json", "r") as f: post_image = True cal_w_dir = "/SNS/PG3/shared/CALIBRATION" cal_config_f = os.path.join(cal_w_dir, "cal_config.json") with open(cal_config_f, "r") as f: cal_config = json.load(f) dia_file_name = os.path.basename(cal_config["Diamond"]) Loading Loading @@ -168,7 +172,10 @@ sam_env = cal_config["SampleEnv"] dia_name = f"d{dia_run_num}" date = cal_config["Date"] notes = cal_config["Notes"] if notes.strip() != "": cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}-{notes}.h5" else: cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}.h5" out_dir_1 = os.path.join(working_dir, cal_config["RunCycle"]) out_dir_2 = cal_config["OutputDir"] if working_dir not in out_dir_2: Loading Loading @@ -262,8 +269,6 @@ for det, mask in enumerate(mtd['_mask'].extractY()): max_all = np.nanmax(data) zmax_val = max_all / 10. html = "" fig, ax = plt.subplots() heatmap = ax.pcolormesh(data, cmap='viridis', vmax=zmax_val) colorbar = plt.colorbar(heatmap, ax=ax) Loading @@ -271,13 +276,26 @@ ax.set_xticks(np.arange(0, 350, 50), np.arange(0., 3.5, 0.5)) ax.set_xlabel('d-spacing') ax.set_ylabel('Detectors') diag_file_name = cal_file_name.replace(".h5", "_diag_1.png") diag_dir_1 = os.path.join(out_dir_1, "diagnostics") if not os.path.exists(diag_dir_1): os.makedirs(diag_dir_1) diag_dir_2 = os.path.join(out_dir_2, "diagnostics") if not os.path.exists(diag_dir_2): os.makedirs(diag_dir_2) diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') html_tmp = '<h4>Pixel-by-pixel line-up for diamond</h4>' html_tmp += '<img src=\'data:image/png;base64,{}\'>'.format(encoded) html += "<div>{}</div>".format(html_tmp) html = "<div>{}</div>".format(html_tmp) # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # ||||| Diagnostics-2 ||||| Loading @@ -286,6 +304,14 @@ html += "<div>{}</div>".format(html_tmp) fig, ax = diagnostics.difc_plot2d("_cal", "_cal_eng", instr_ws="_group", mask="_mask", vrange=(0, 5)) diag_file_name = cal_file_name.replace(".h5", "_diag_2.png") diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') Loading
pg3_cal_dev.py→pg3_cal_local.py +44 −18 Original line number Diff line number Diff line Loading @@ -29,7 +29,11 @@ from Calibration.tofpd import diagnostics # ||||| Set-up session ||||| # vvvvv vvvvv # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ with open("cal_config.json", "r") as f: post_image = False cal_w_dir = "/SNS/PG3/shared/CALIBRATION" cal_config_f = os.path.join(cal_w_dir, "cal_config.json") with open(cal_config_f, "r") as f: cal_config = json.load(f) dia_file_name = os.path.basename(cal_config["Diamond"]) Loading Loading @@ -168,7 +172,10 @@ sam_env = cal_config["SampleEnv"] dia_name = f"d{dia_run_num}" date = cal_config["Date"] notes = cal_config["Notes"] if notes.strip() != "": cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}-{notes}.h5" else: cal_file_name = f"{instr_name}_{sam_env}_{dia_name}_{date}.h5" out_dir_1 = os.path.join(working_dir, cal_config["RunCycle"]) out_dir_2 = cal_config["OutputDir"] if working_dir not in out_dir_2: Loading Loading @@ -262,8 +269,6 @@ for det, mask in enumerate(mtd['_mask'].extractY()): max_all = np.nanmax(data) zmax_val = max_all / 10. html = "" fig, ax = plt.subplots() heatmap = ax.pcolormesh(data, cmap='viridis', vmax=zmax_val) colorbar = plt.colorbar(heatmap, ax=ax) Loading @@ -271,13 +276,26 @@ ax.set_xticks(np.arange(0, 350, 50), np.arange(0., 3.5, 0.5)) ax.set_xlabel('d-spacing') ax.set_ylabel('Detectors') diag_file_name = cal_file_name.replace(".h5", "_diag_1.png") diag_dir_1 = os.path.join(out_dir_1, "diagnostics") if not os.path.exists(diag_dir_1): os.makedirs(diag_dir_1) diag_dir_2 = os.path.join(out_dir_2, "diagnostics") if not os.path.exists(diag_dir_2): os.makedirs(diag_dir_2) diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') html_tmp = '<h4>Pixel-by-pixel line-up for diamond</h4>' html_tmp += '<img src=\'data:image/png;base64,{}\'>'.format(encoded) html += "<div>{}</div>".format(html_tmp) html = "<div>{}</div>".format(html_tmp) # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # ||||| Diagnostics-2 ||||| Loading @@ -286,6 +304,14 @@ html += "<div>{}</div>".format(html_tmp) fig, ax = diagnostics.difc_plot2d("_cal", "_cal_eng", instr_ws="_group", mask="_mask", vrange=(0, 5)) diag_file_name = cal_file_name.replace(".h5", "_diag_2.png") diag_file_1 = os.path.join(diag_dir_1, diag_file_name) fig.savefig(diag_file_1, format='png', dpi=300) diag_file_2 = os.path.join(diag_dir_2, diag_file_name) fig.savefig(diag_file_2, format='png', dpi=300) if post_image: tmpfile = BytesIO() fig.savefig(tmpfile, format='png', dpi=200) encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8') Loading