|
27 | 27 | "import numpy as np\n", |
28 | 28 | "import pandas as pd\n", |
29 | 29 | "\n", |
| 30 | + "\n", |
30 | 31 | "from image_analysis.offline_analyzers.magspec_manual_calib_analyzer import (\n", |
31 | 32 | " MagSpecManualCalibAnalyzer,\n", |
32 | 33 | ")\n", |
33 | | - "from image_analysis.offline_analyzers.beam_analyzer import BeamAnalyzer\n", |
34 | 34 | "\n", |
35 | 35 | "logging.getLogger(\"image_analysis\").setLevel(logging.WARNING)\n", |
36 | 36 | "logging.getLogger(\"geecs_data_utils\").setLevel(logging.WARNING)\n", |
|
46 | 46 | "\n", |
47 | 47 | "# calibrations are stored in the repo, provide their path\n", |
48 | 48 | "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\"" |
50 | 50 | ] |
51 | 51 | }, |
52 | 52 | { |
|
80 | 80 | "shot = 3\n", |
81 | 81 | "\n", |
82 | 82 | "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", |
84 | 89 | ")\n", |
85 | 90 | "\n", |
86 | 91 | "bkg = ScanData.from_date(\n", |
87 | 92 | " year=2026, month=3, day=23, number=bkg_scan, experiment=\"Thomson\", append_paths=True\n", |
88 | 93 | ")\n", |
89 | 94 | "\n", |
90 | 95 | "# 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", |
93 | 98 | "\n", |
94 | 99 | "\n", |
95 | 100 | "# setup for constrcuting magcam1 analyzer\n", |
96 | 101 | "dev_name_1 = \"HTT-C23_1_MagSpec1\"\n", |
97 | 102 | "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", |
99 | 104 | "bkg_path_1 = bkg.data_frame[f\"{dev_name_1}_expected_path\"][3]\n", |
100 | 105 | "\n", |
101 | 106 | "analyzer_1 = MagSpecManualCalibAnalyzer(camera_config_name=config_name_1)\n", |
|
104 | 109 | "new_bkg_1 = cfg.BackgroundConfig()\n", |
105 | 110 | "new_bkg_1.method = \"from_file\"\n", |
106 | 111 | "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", |
108 | 113 | "analyzer_1.update_config(background=new_bkg_1)\n", |
109 | 114 | "\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", |
113 | 117 | "\n", |
114 | 118 | "# setup for constrcuting magcam2 analyzer\n", |
115 | 119 | "dev_name_2 = \"HTT-C23_2_MagSpec2\"\n", |
116 | 120 | "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", |
118 | 122 | "bkg_path_2 = bkg.data_frame[f\"{dev_name_2}_expected_path\"][3]\n", |
119 | 123 | "\n", |
120 | 124 | "new_bkg_2 = cfg.BackgroundConfig()\n", |
|
125 | 129 | "new_bkg_2 = cfg.BackgroundConfig()\n", |
126 | 130 | "new_bkg_2.method = \"from_file\"\n", |
127 | 131 | "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", |
129 | 133 | "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)" |
132 | 135 | ] |
133 | 136 | }, |
134 | 137 | { |
|
231 | 234 | } |
232 | 235 | ], |
233 | 236 | "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", |
238 | 242 | "df = pd.read_csv(analyzed_data_path, sep=\"\\t\")\n", |
239 | 243 | "\n", |
240 | 244 | "signal_calib_1 = np.sum(res_1.processed_image, axis=0) / 1000\n", |
|
278 | 282 | "metadata": {}, |
279 | 283 | "outputs": [], |
280 | 284 | "source": [ |
281 | | - "\n", |
282 | 285 | "from image_analysis.offline_analyzers.magspec_manual_calib_analyzer import (\n", |
283 | 286 | " DnnAxisCalibration,\n", |
284 | 287 | ")\n", |
|
350 | 353 | ], |
351 | 354 | "metadata": { |
352 | 355 | "kernelspec": { |
353 | | - "display_name": "Python 3 (ipykernel)", |
| 356 | + "display_name": "Python (geecs-plugins, poetry)", |
354 | 357 | "language": "python", |
355 | | - "name": "python3" |
| 358 | + "name": "geecs-plugins-py310" |
356 | 359 | }, |
357 | 360 | "language_info": { |
358 | 361 | "codemirror_mode": { |
|
364 | 367 | "name": "python", |
365 | 368 | "nbconvert_exporter": "python", |
366 | 369 | "pygments_lexer": "ipython3", |
367 | | - "version": "3.10.18" |
| 370 | + "version": "3.10.11" |
368 | 371 | } |
369 | 372 | }, |
370 | 373 | "nbformat": 4, |
|
0 commit comments