Skip to content

Commit 8be40a7

Browse files
committed
formating
1 parent 35c51d6 commit 8be40a7

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

docs/image_analysis/examples/HTT_magspec_analysis_tests.ipynb

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"import numpy as np\n",
2828
"import pandas as pd\n",
2929
"\n",
30+
"\n",
3031
"from image_analysis.offline_analyzers.magspec_manual_calib_analyzer import (\n",
3132
" MagSpecManualCalibAnalyzer,\n",
3233
")\n",
33-
"from image_analysis.offline_analyzers.beam_analyzer import BeamAnalyzer\n",
3434
"\n",
3535
"logging.getLogger(\"image_analysis\").setLevel(logging.WARNING)\n",
3636
"logging.getLogger(\"geecs_data_utils\").setLevel(logging.WARNING)\n",
@@ -46,7 +46,7 @@
4646
"\n",
4747
"# calibrations are stored in the repo, provide their path\n",
4848
"img_analysis_dir = Path(os.getcwd()).parents[2] / \"ImageAnalysis\" / \"image_analysis\"\n",
49-
"magspec_calibrations_dir = img_analysis_dir / 'data' / \"HTT-MagSpce-Calibrations\""
49+
"magspec_calibrations_dir = img_analysis_dir / \"data\" / \"HTT-MagSpce-Calibrations\""
5050
]
5151
},
5252
{
@@ -80,22 +80,27 @@
8080
"shot = 3\n",
8181
"\n",
8282
"sd = ScanData.from_date(\n",
83-
" year=2026, month=3, day=23, number=scan_number, experiment=\"Thomson\", append_paths=True\n",
83+
" year=2026,\n",
84+
" month=3,\n",
85+
" day=23,\n",
86+
" number=scan_number,\n",
87+
" experiment=\"Thomson\",\n",
88+
" append_paths=True,\n",
8489
")\n",
8590
"\n",
8691
"bkg = ScanData.from_date(\n",
8792
" year=2026, month=3, day=23, number=bkg_scan, experiment=\"Thomson\", append_paths=True\n",
8893
")\n",
8994
"\n",
9095
"# this was looked up in the sfile. Note, this can be defined in the config file, but we\n",
91-
"# explicitly set it here for the example \n",
92-
"bfield = {'HTT-MagTeslameter-DTM141 Field':0.4265}\n",
96+
"# explicitly set it here for the example\n",
97+
"bfield = {\"HTT-MagTeslameter-DTM141 Field\": 0.4265}\n",
9398
"\n",
9499
"\n",
95100
"# setup for constrcuting magcam1 analyzer\n",
96101
"dev_name_1 = \"HTT-C23_1_MagSpec1\"\n",
97102
"config_name_1 = \"HTT-MagCam1\"\n",
98-
"file_path_1 = sd.data_frame[f\"{dev_name_1}_expected_path\"][shot-1]\n",
103+
"file_path_1 = sd.data_frame[f\"{dev_name_1}_expected_path\"][shot - 1]\n",
99104
"bkg_path_1 = bkg.data_frame[f\"{dev_name_1}_expected_path\"][3]\n",
100105
"\n",
101106
"analyzer_1 = MagSpecManualCalibAnalyzer(camera_config_name=config_name_1)\n",
@@ -104,17 +109,16 @@
104109
"new_bkg_1 = cfg.BackgroundConfig()\n",
105110
"new_bkg_1.method = \"from_file\"\n",
106111
"new_bkg_1.file_path = bkg_path_1\n",
107-
"new_bkg_1.additional_constant=0.9\n",
112+
"new_bkg_1.additional_constant = 0.9\n",
108113
"analyzer_1.update_config(background=new_bkg_1)\n",
109114
"\n",
110-
"#construct the analyzer for magcam1\n",
111-
"res_1 = analyzer_1.analyze_image_file(image_filepath=file_path_1, \n",
112-
" auxiliary_data=bfield)\n",
115+
"# construct the analyzer for magcam1\n",
116+
"res_1 = analyzer_1.analyze_image_file(image_filepath=file_path_1, auxiliary_data=bfield)\n",
113117
"\n",
114118
"# setup for constrcuting magcam2 analyzer\n",
115119
"dev_name_2 = \"HTT-C23_2_MagSpec2\"\n",
116120
"config_name_2 = \"HTT-MagCam2\"\n",
117-
"file_path_2 = sd.data_frame[f\"{dev_name_2}_expected_path\"][shot-1]\n",
121+
"file_path_2 = sd.data_frame[f\"{dev_name_2}_expected_path\"][shot - 1]\n",
118122
"bkg_path_2 = bkg.data_frame[f\"{dev_name_2}_expected_path\"][3]\n",
119123
"\n",
120124
"new_bkg_2 = cfg.BackgroundConfig()\n",
@@ -125,10 +129,9 @@
125129
"new_bkg_2 = cfg.BackgroundConfig()\n",
126130
"new_bkg_2.method = \"from_file\"\n",
127131
"new_bkg_2.file_path = bkg_path_2\n",
128-
"new_bkg_2.additional_constant=1.7\n",
132+
"new_bkg_2.additional_constant = 1.7\n",
129133
"analyzer_2.update_config(background=new_bkg_2)\n",
130-
"res_2 = analyzer_2.analyze_image_file(image_filepath=file_path_2,\n",
131-
" auxiliary_data=bfield)"
134+
"res_2 = analyzer_2.analyze_image_file(image_filepath=file_path_2, auxiliary_data=bfield)"
132135
]
133136
},
134137
{
@@ -231,10 +234,11 @@
231234
}
232235
],
233236
"source": [
234-
"sn = str(scan_number).rjust(3,\"0\")\n",
235-
"shot_str = str(shot).rjust(3,\"0\")\n",
236-
"analyzed_data_path = (sd.paths.get_analysis_folder() / \n",
237-
" f\"MgspcHtt/Scan{sn}_MgspcHttSpec_{shot_str}.txt\" )\n",
237+
"sn = str(scan_number).rjust(3, \"0\")\n",
238+
"shot_str = str(shot).rjust(3, \"0\")\n",
239+
"analyzed_data_path = (\n",
240+
" sd.paths.get_analysis_folder() / f\"MgspcHtt/Scan{sn}_MgspcHttSpec_{shot_str}.txt\"\n",
241+
")\n",
238242
"df = pd.read_csv(analyzed_data_path, sep=\"\\t\")\n",
239243
"\n",
240244
"signal_calib_1 = np.sum(res_1.processed_image, axis=0) / 1000\n",
@@ -278,7 +282,6 @@
278282
"metadata": {},
279283
"outputs": [],
280284
"source": [
281-
"\n",
282285
"from image_analysis.offline_analyzers.magspec_manual_calib_analyzer import (\n",
283286
" DnnAxisCalibration,\n",
284287
")\n",
@@ -350,9 +353,9 @@
350353
],
351354
"metadata": {
352355
"kernelspec": {
353-
"display_name": "Python 3 (ipykernel)",
356+
"display_name": "Python (geecs-plugins, poetry)",
354357
"language": "python",
355-
"name": "python3"
358+
"name": "geecs-plugins-py310"
356359
},
357360
"language_info": {
358361
"codemirror_mode": {
@@ -364,7 +367,7 @@
364367
"name": "python",
365368
"nbconvert_exporter": "python",
366369
"pygments_lexer": "ipython3",
367-
"version": "3.10.18"
370+
"version": "3.10.11"
368371
}
369372
},
370373
"nbformat": 4,

0 commit comments

Comments
 (0)