From 767974edc5f91974d84bc4a8509dc0a20f00982c Mon Sep 17 00:00:00 2001 From: Kristopher Cooper Date: Fri, 26 Sep 2025 16:35:36 -0500 Subject: [PATCH 1/7] starting adding CMOS to telescope_parts --- response_tools/telescope_parts.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/response_tools/telescope_parts.py b/response_tools/telescope_parts.py index f7513e0..325eaac 100644 --- a/response_tools/telescope_parts.py +++ b/response_tools/telescope_parts.py @@ -18,6 +18,16 @@ eff_area_nagoya_hxt, ) +# position 0 +@u.quantity_input(mid_energies=u.keV) +def foxsi4_position0_obf(mid_energies): + pass + +# position 1 +@u.quantity_input(mid_energies=u.keV) +def foxsi4_position1_obf(mid_energies): + pass + # position 2 @u.quantity_input(mid_energies=u.keV) def foxsi4_position2_thermal_blanket(mid_energies): From 9b6a9813f27ed07c311ccd9bb6deff45fdd15a83 Mon Sep 17 00:00:00 2001 From: Kristopher Cooper Date: Fri, 26 Sep 2025 16:54:50 -0500 Subject: [PATCH 2/7] started incorporating the downloader --- response-information/atmospheric-data/README.md | 3 --- response-information/attenuation-data/README.md | 3 --- response-information/detector-response-data/README.md | 3 --- response-information/effective-area-data/README.md | 7 ------- response-information/quantum-efficiency-data/README.md | 3 --- response_tools/attenuation.py | 3 +-- 6 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 response-information/atmospheric-data/README.md delete mode 100644 response-information/attenuation-data/README.md delete mode 100644 response-information/detector-response-data/README.md delete mode 100644 response-information/effective-area-data/README.md delete mode 100644 response-information/quantum-efficiency-data/README.md diff --git a/response-information/atmospheric-data/README.md b/response-information/atmospheric-data/README.md deleted file mode 100644 index 9775858..0000000 --- a/response-information/atmospheric-data/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Detector quantum efficiency data files - -Only really here so this folder is tracked by `git`. diff --git a/response-information/attenuation-data/README.md b/response-information/attenuation-data/README.md deleted file mode 100644 index 309fbba..0000000 --- a/response-information/attenuation-data/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Attenuator data files - -Only really here so this folder is tracked by `git`. diff --git a/response-information/detector-response-data/README.md b/response-information/detector-response-data/README.md deleted file mode 100644 index 3b663b9..0000000 --- a/response-information/detector-response-data/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Detector response data files - -Only really here so this folder is tracked by `git`. diff --git a/response-information/effective-area-data/README.md b/response-information/effective-area-data/README.md deleted file mode 100644 index 43d64b8..0000000 --- a/response-information/effective-area-data/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Effective area data files - -Only really here so this folder is tracked by `git`. - -## Content -- `nagoya_hxt_onaxis_measurement_v1.txt` is the effective area data for the position 4 optic. -- `nagoya_sxt_onaxis_measurement_v1.txt` is the data for the position 1 optic, and includes OBFs and collimators. diff --git a/response-information/quantum-efficiency-data/README.md b/response-information/quantum-efficiency-data/README.md deleted file mode 100644 index 9775858..0000000 --- a/response-information/quantum-efficiency-data/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Detector quantum efficiency data files - -Only really here so this folder is tracked by `git`. diff --git a/response_tools/attenuation.py b/response_tools/attenuation.py index 076f259..aaf3c79 100644 --- a/response_tools/attenuation.py +++ b/response_tools/attenuation.py @@ -16,7 +16,6 @@ from response_tools.util import BaseOutput, native_resolution ATT_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "response-information", "attenuation-data") -ATM_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "response-information", "atmospheric-data") ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "att-figs") @dataclass @@ -472,7 +471,7 @@ def att_foxsi4_atmosphere(mid_energies, time_range=None, file=None): warnings.warn(f"{sys._getframe().f_code.co_name} `time_range` (convertable to astropy.units.seconds) should be of length 2.") return - _f = os.path.join(ATM_PATH, f"FOXSI4_atmospheric_transmission_v1.fits") if file is None else file + _f = os.path.join(ATT_PATH, f"FOXSI4_atmospheric_transmission_v1.fits") if file is None else file with fits.open(_f) as hdul: native_times, native_energies, transmission = hdul[1].data["TIME"][0]< Date: Fri, 26 Sep 2025 17:15:04 -0500 Subject: [PATCH 3/7] added early foxsi-4 files to YAML --- response-information/info.yaml | 15 +++++++++++++-- response_tools/effective_area.py | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/response-information/info.yaml b/response-information/info.yaml index 46b0e59..460edd5 100644 --- a/response-information/info.yaml +++ b/response-information/info.yaml @@ -5,8 +5,17 @@ files: eff_area_telescope-5-pan_msfc_heritage: "effective-area-data/FOXSI3_Module_X-8_EA_pan_v1.txt" eff_area_telescope-5-tilt_msfc_heritage: "effective-area-data/FOXSI3_Module_X-8_EA_tilt_v1.txt" eff_area_msfc_hi_res: "effective-area-data/FOXSI4_Module_MSFC_HiRes_EA_with_models_v1.txt" - eff_area_nagoya_hxt: "effective-area-data/nagoya_hxt_onaxis_measurement_v1.txt" - eff_area_nagoya_sxt: "effective-area-data/nagoya_sxt_onaxis_measurement_v1.txt" + eff_area_measured_nagoya_hxt: "effective-area-data/nagoya_hxt_onaxis_measurement_v1.txt" + eff_area_measured_sxt: "effective-area-data/nagoya_sxt_onaxis_measurement_v1.txt" + + # eff_area_cmos_mirror0: "effective-area-data/foxsi4_telescope-0_BASIC_mirror_effective_area_v1.fits" + # eff_area_cmos_mirror1: "effective-area-data/foxsi4_telescope-1_BASIC_mirror_effective_area_v1.fits" + # eff_area_cmos_telescope0: "effective-area-data/foxsi4_telescope-0_BASIC_TELESCOPE_RESPONSE_v1.fits" + # eff_area_cmos_telescope1: "effective-area-data/foxsi4_telescope-1_BASIC_TELESCOPE_RESPONSE_v1.fits" + # eff_area_early_nagoya_sxt: "effective-area-data/effective-area_raytracing_soft-xray-optic_on-axis.txt" + # eff_area_early_msfc_hi_res: "effective-area-data/3Inner_EA_EPDL97_14AA.csv" + # eff_area_modeled_nagoya_hxt: "effective-area-data/HXR_Nagoya_FOXSI4.arf" + # eff_area_modeled_nagoya_sxt: "effective-area-data/SXR_nocollimator_noobf.arf" detectors: cmos_det_telescope-0_resp: "detector-response-data/cmos/foxsi4_telescope-0_BASIC_RESPONSE_MATRIX_v1.fits" @@ -26,6 +35,8 @@ files: att_telescope-1_cmos_prefilter: "attenuation-data/foxsi4_telescope-1_BASIC_attenuation_filter_transmittance_v1.fits" att_foxsi4_atmosphere: "attenuation-data/FOXSI4_atmospheric_transmission_v1.fits" + # att_early_cmos_prefilter: "attenuation-data/CMOST_Prefilter_transmission.dat" + quantum_efficiency: qe_cmos_telescope-0: "quantum-efficiency-data/foxsi4_telescope-0_BASIC_sensor_quantum_efficiency_v1.fits" qe_cmos_telescope-1: "quantum-efficiency-data/foxsi4_telescope-1_BASIC_sensor_quantum_efficiency_v1.fits" diff --git a/response_tools/effective_area.py b/response_tools/effective_area.py index d9cd4b2..d904ac8 100644 --- a/response_tools/effective_area.py +++ b/response_tools/effective_area.py @@ -477,7 +477,7 @@ def eff_area_cmos_telescope(mid_energies, telescope=None, file=None): logging.warning("If you care about what elements are included then proceed carefully.") logging.warning("For current file, see PR#11 in the `cmos-tools` repository.") - _f = os.path.join(EFF_PATH, f"foxsi4_telescope-{telescope}_BASIC_TELESCOPE_RESPONSE_V25APR13.fits") if file is None else file + _f = os.path.join(EFF_PATH, f"foxsi4_telescope-{telescope}_BASIC_TELESCOPE_RESPONSE_v1.fits") if file is None else file with fits.open(_f) as hdul: # _ is the off-axis angle but it's just [0] at the minute ea_energies, _, effas = hdul[2].data << u.keV, hdul[3].data << u.arcsec, hdul[1].data << u.cm**2 From 51a0cae55c8ea118480a835472af497a902eff0d Mon Sep 17 00:00:00 2001 From: Kristopher Cooper Date: Mon, 29 Sep 2025 11:54:00 -0500 Subject: [PATCH 4/7] Updated files being called to versioned ones --- .gitignore | 10 +- response-information/README.md | 162 ----------------------- response-information/info.yaml | 46 ------- response_tools/__init__.py | 7 + response_tools/attenuation.py | 4 +- response_tools/detector_response.py | 2 +- response_tools/effective_area.py | 6 +- response_tools/io/fetch_response_data.py | 2 +- response_tools/io/load_yaml.py | 2 +- response_tools/quantum_efficiency.py | 2 +- tests/README.md | 3 - 11 files changed, 21 insertions(+), 225 deletions(-) delete mode 100644 response-information/README.md delete mode 100644 response-information/info.yaml delete mode 100644 tests/README.md diff --git a/.gitignore b/.gitignore index 147841a..ff207a0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,11 +10,11 @@ response_tools.egg-info/ build/ # data directories -response-information/attenuation-data/ -response-information/detector-response-data/ -response-information/effective-area-data/ -response-information/quantum-efficiency-data/ -response-information/atmospheric-data/ +response_tools/response-information/attenuation-data/ +response_tools/response-information/detector-response-data/ +response_tools/response-information/effective-area-data/ +response_tools/response-information/quantum-efficiency-data/ +response_tools/response-information/atmospheric-data/ # environment .env/ diff --git a/response-information/README.md b/response-information/README.md deleted file mode 100644 index afee3cc..0000000 --- a/response-information/README.md +++ /dev/null @@ -1,162 +0,0 @@ -# Response information - -This directory contains general information on the the response elements. - -## Response element description - -We will list the files here (same as on the repository's main README) but also show the original file names that are not consistently version so the mapping is always known. - -When a newer version of a file comes along, the text describing any old file can be added to the "Old response element description" section and the new information added here. - -### Position 0 (SXR, CMOS1) - -- **Optical blocking filter:** `"foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_v1.fits"` - - _Original file:_ `"foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Collimator:** `"foxsi4_telescope-0_BASIC_collimator_aperture_ratio_v1.fits"` - - _Original file:_ `"foxsi4_telescope-0_BASIC_collimator_aperture_ratio_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Optics:** `"foxsi4_telescope-0_BASIC_mirror_effective_area_v1.fits"` - - _Original file:_ `"foxsi4_telescope-0_BASIC_mirror_effective_area_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Filter:** `"foxsi4_telescope-0_BASIC_attenuation_filter_transmittance_v1.fits"` - - _Original file:_ `"foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Quantum efficiency:** `"foxsi4_telescope-0_BASIC_sensor_quantum_efficiency_v1.fits"` - - _Original file:_ `"foxsi4_telescope-0_BASIC_sensor_quantum_efficiency_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Detector response:** `"foxsi4_telescope-0_BASIC_RESPONSE_MATRIX_v1.fits"` - - _Original file:_ `"foxsi4_telescope-0_BASIC_RESPONSE_MATRIX_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ - -### Position 1 (SXR, CMOS2) - -- **Optical blocking filter:** `"foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_v1.fits"` - - _Original file:_ `"foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Collimator:** `"foxsi4_telescope-1_BASIC_collimator_aperture_ratio_v1.fits"` - - _Original file:_ `"foxsi4_telescope-1_BASIC_collimator_aperture_ratio_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Optics:** `"foxsi4_telescope-1_BASIC_mirror_effective_area_v1.fits"` - - _Original file:_ `"foxsi4_telescope-1_BASIC_mirror_effective_area_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Filter:** `"foxsi4_telescope-1_BASIC_attenuation_filter_transmittance_v1.fits"` - - _Original file:_ `"foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Quantum efficiency:** `"foxsi4_telescope-1_BASIC_sensor_quantum_efficiency_v1.fits"` - - _Original file:_ `"foxsi4_telescope-1_BASIC_sensor_quantum_efficiency_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ -- **Detector response:** `"foxsi4_telescope-1_BASIC_RESPONSE_MATRIX_v1.fits"` - - _Original file:_ `"foxsi4_telescope-1_BASIC_RESPONSE_MATRIX_V25APR13.fits"` - - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) - - _Version description:_ - -### Position 2 (HXR, CdTe4) - -- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` - - _Original file:_ `"F4_Blanket_transmission.dat"` - - _Origin:_ Uses [see Morgan] - - _Version description:_ -- **Optics:** `"FOXSI3_Module_X-7_EA_pan_v1.txt"` & `"FOXSI3_Module_X-7_EA_tilt_v1.txt"` (Marshall 10-shell X-7) - - _Original file:_ `"FOXSI3_Module_X-7_EA_pan.txt"` & `"FOXSI3_Module_X-7_EA_tilt.txt"` - - _Origin:_ The original `foxsi-science` [Github repository](https://github.com/foxsi/foxsi-science/tree/master/calibration_data). - - _Version description:_ -- **Filter:** `"unif_att_p2_theoretical_v1.csv"` (Al 0.015") - - _Original file:_ `"unif_att_p2_theoretical.csv"` - - _Origin:_ In the Google Drive `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Uniform attenuators (theoretical)` - - _Version description:_ -- **Detector response:** "" - -### Position 3 (HXR, CdTe2) - -- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` - - _Original file:_ `"F4_Blanket_transmission.dat"` - - _Origin:_ Uses [see Morgan] - - _Version description:_ -- **Optics:** `"FOXSI4_Module_MSFC_HiRes_EA_with_models_v1.txt"` (Marshall 2-shell X09/FM2) - - _Original file:_ `"FOXSI4_Effective_Areas_2025April11.txt"`[*](../response_tools/aux) - - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Optics`>`msfc-hi-res`>`model-data-comparison` - - _Version description:_ -- **Filter:** `"thin_mylar_p3_p5_theoretical_v1.csv"` - - _Original file:_ `"thin_mylar_p3_p5_theoretical.csv"` - - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Aluminized mylar detector window` - - _Version description:_ -- **Pixelated attenuator:** `"20240607_fosxi4_transmission_v1.csv"` - - _Original file:_ `"20240607_fosxi4_transmission.csv"` - - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Attenuator data analysis`>`gsfc_foxsi_attenuator_analysis` - - _Version description:_ -- **Detector response:** "" - -### Position 4 (HXR, CdTe3) - -- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` - - _Original file:_ `"F4_Blanket_transmission.dat"` - - _Origin:_ Uses [see Morgan] - - _Version description:_ -- **Optics:** `"nagoya_hxt_onaxis_measurement_v1.txt"` (Nagoya 1-shell HXT) - - _Original file:_ `"gain-corrrection_focused_incident_0.0207951x-plus--0.0552269_to_0.0207959x-plus--0.0492531_grpmin1000_Be_focused300.0s_incident300.0s_plot.txt"` - - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Optics`>`Nagoya_optics`>`on-axis_effective_area_measurement`>`HXR`>`on-axis_EA` - - _Version description:_ HXR on-axis. -- **Filter:** `"unif_att_p4_theoretical_v1.csv"` (Al 0.015") - - _Original file:_ `"unif_att_p4_theoretical.csv"` - - _Origin:_ In the Google Drive `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Uniform attenuators (theoretical)` -- **Detector response:** "" - -### Position 5 (HXR, CdTe1) - -- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` - - _Original file:_ `"F4_Blanket_transmission.dat"` - - _Origin:_ Uses [see Morgan] - - _Version description:_ -- **Optics:** `"FOXSI3_Module_X-8_EA_pan_v1.txt"` & `"FOXSI3_Module_X-8_EA_tilt_v1.txt"` (Marshall 10-shell X-8) - - _Original file:_ `"FOXSI3_Module_X-8_EA_pan.txt"` & `"FOXSI3_Module_X-8_EA_tilt.txt"` - - _Origin:_ The original `foxsi-science` [Github repository](https://github.com/foxsi/foxsi-science/tree/master/calibration_data). - - _Version description:_ -- **Filter:** `"thin_mylar_p3_p5_theoretical_v1.csv"` - - _Original file:_ `"thin_mylar_p3_p5_theoretical.csv"` - - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Aluminized mylar detector window` - - _Version description:_ -- **Pixelated attenuator:** `"20240607_fosxi4_transmission_v1.csv"` - - _Original file:_ `"20240607_fosxi4_transmission.csv"` - - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Attenuator data analysis`>`gsfc_foxsi_attenuator_analysis` - - _Version description:_ -- **Detector response:** "" - -### Position 6 (Timepix) - -- N/A - -## Old response element descriptions - -### Other response files - -This could include old files used in the pre-launch stage, intermediate, or unused products. - -These will likely be untracked by file versions but might be useful at some point. - -These files are: - -- `"foxsi4_telescope-N_BASIC_TELESCOPE_RESPONSE_V25APR13.fits"` - - `N` will be `0` or `1`, depending on the CMOS position of interest. - - This is an initial file that pre-combines a bunch of response elements to create an ARF-like file. -- `"CMOST_Prefilter_transmission.dat"` - - Early CMOS pre-filter values used in pre-launch simulations. -- `"3Inner_EA_EPDL97_14AA.csv"` - - Early MSCF hi-res effective areas used in pre-launch simulations. -- `"effective-area_raytracing_soft-xray-optic_on-axis.txt"` - - Early Nagoya SXR hi-res effective areas used in pre-launch simulations. -- **Optics:** `"nagoya_sxt_onaxis_measurement_v1.txt"` (Nagoya 1-shell HXT) - - _Original file:_ `"focused_incident_grpmin1000_C1_focused1800.0s_incident1800.0s_plot.txt"` - - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Optics`>`Nagoya_optics`>`on-axis_effective_area_measurement`>`SXR`>`on-axis_EA` - - _Version description:_ SXR on-axis. diff --git a/response-information/info.yaml b/response-information/info.yaml deleted file mode 100644 index 460edd5..0000000 --- a/response-information/info.yaml +++ /dev/null @@ -1,46 +0,0 @@ -files: - optics: - eff_area_telescope-2-pan_msfc_heritage: "effective-area-data/FOXSI3_Module_X-7_EA_pan_v1.txt" - eff_area_telescope-2-tilt_msfc_heritage: "effective-area-data/FOXSI3_Module_X-7_EA_tilt_v1.txt" - eff_area_telescope-5-pan_msfc_heritage: "effective-area-data/FOXSI3_Module_X-8_EA_pan_v1.txt" - eff_area_telescope-5-tilt_msfc_heritage: "effective-area-data/FOXSI3_Module_X-8_EA_tilt_v1.txt" - eff_area_msfc_hi_res: "effective-area-data/FOXSI4_Module_MSFC_HiRes_EA_with_models_v1.txt" - eff_area_measured_nagoya_hxt: "effective-area-data/nagoya_hxt_onaxis_measurement_v1.txt" - eff_area_measured_sxt: "effective-area-data/nagoya_sxt_onaxis_measurement_v1.txt" - - # eff_area_cmos_mirror0: "effective-area-data/foxsi4_telescope-0_BASIC_mirror_effective_area_v1.fits" - # eff_area_cmos_mirror1: "effective-area-data/foxsi4_telescope-1_BASIC_mirror_effective_area_v1.fits" - # eff_area_cmos_telescope0: "effective-area-data/foxsi4_telescope-0_BASIC_TELESCOPE_RESPONSE_v1.fits" - # eff_area_cmos_telescope1: "effective-area-data/foxsi4_telescope-1_BASIC_TELESCOPE_RESPONSE_v1.fits" - # eff_area_early_nagoya_sxt: "effective-area-data/effective-area_raytracing_soft-xray-optic_on-axis.txt" - # eff_area_early_msfc_hi_res: "effective-area-data/3Inner_EA_EPDL97_14AA.csv" - # eff_area_modeled_nagoya_hxt: "effective-area-data/HXR_Nagoya_FOXSI4.arf" - # eff_area_modeled_nagoya_sxt: "effective-area-data/SXR_nocollimator_noobf.arf" - - detectors: - cmos_det_telescope-0_resp: "detector-response-data/cmos/foxsi4_telescope-0_BASIC_RESPONSE_MATRIX_v1.fits" - cmos_det_telescope-1_resp: "detector-response-data/cmos/foxsi4_telescope-1_BASIC_RESPONSE_MATRIX_v1.fits" - - attenuation: - att_thermal_blanket: "attenuation-data/F4_Blanket_transmission_v1.dat" - att_pixelated: "attenuation-data/20240607_fosxi4_transmission_v1.csv" - att_al_mylar: "attenuation-data/thin_mylar_p3_p5_theoretical_v1.csv" - att_telescope-2_uniform_al_cdte: "attenuation-data/unif_att_p2_theoretical_v1.csv" - att_telescope-4_uniform_al_cdte: "attenuation-data/unif_att_p4_theoretical_v1.csv" - att_telescope-0_collimator_ratio: "attenuation-data/foxsi4_telescope-0_BASIC_collimator_aperture_ratio_v1.fits" - att_telescope-1_collimator_ratio: "attenuation-data/foxsi4_telescope-1_BASIC_collimator_aperture_ratio_v1.fits" - att_telescope-0_cmos_obfilter: "attenuation-data/foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_v1.fits" - att_telescope-1_cmos_obfilter: "attenuation-data/foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_v1.fits" - att_telescope-0_cmos_prefilter: "attenuation-data/foxsi4_telescope-0_BASIC_attenuation_filter_transmittance_v1.fits" - att_telescope-1_cmos_prefilter: "attenuation-data/foxsi4_telescope-1_BASIC_attenuation_filter_transmittance_v1.fits" - att_foxsi4_atmosphere: "attenuation-data/FOXSI4_atmospheric_transmission_v1.fits" - - # att_early_cmos_prefilter: "attenuation-data/CMOST_Prefilter_transmission.dat" - - quantum_efficiency: - qe_cmos_telescope-0: "quantum-efficiency-data/foxsi4_telescope-0_BASIC_sensor_quantum_efficiency_v1.fits" - qe_cmos_telescope-1: "quantum-efficiency-data/foxsi4_telescope-1_BASIC_sensor_quantum_efficiency_v1.fits" - -# remote URL for fetching data. -# can validly append any filename above to the server name to access. -remote_server: "http://foxsi.space.umn.edu/data/response/response-components" diff --git a/response_tools/__init__.py b/response_tools/__init__.py index fea117f..b7e7b69 100644 --- a/response_tools/__init__.py +++ b/response_tools/__init__.py @@ -10,6 +10,9 @@ The information stored in a YAML file that includes information from the flight. +`~response_tools.responseFilePath` + The response data file location. + `~response_tools.__version__` The current version of the code as stated in the setup script. @@ -27,8 +30,12 @@ ... """ +import os +import pathlib + from .version import __version__ from response_tools.io.load_yaml import load_response_context # for global context info contextResponseInfo = load_response_context() +responseFilePath = os.path.join(pathlib.Path(__file__).parent, "response-information") diff --git a/response_tools/attenuation.py b/response_tools/attenuation.py index aaf3c79..1e4559f 100644 --- a/response_tools/attenuation.py +++ b/response_tools/attenuation.py @@ -15,7 +15,7 @@ from response_tools.util import BaseOutput, native_resolution -ATT_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "response-information", "attenuation-data") +ATT_PATH = os.path.join(pathlib.Path(__file__).parent, "response-information", "attenuation-data") ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "att-figs") @dataclass @@ -223,7 +223,7 @@ def _att_old_prefilter(mid_energies, position=None, file=None): if (position is None) or (position not in [0,1]): logging.warning(f"The {sys._getframe().f_code.co_name} `position` must be 0 or 1.") logging.warning(f"Caution: This might not be the function you are looking for ({sys._getframe().f_code.co_name}), please see `att_cmos_obfilter`.") - _f = os.path.join(ATT_PATH, "CMOST_Prefilter_transmission.dat") if file is None else file + _f = os.path.join(ATT_PATH, "CMOST_Prefilter_transmission_v1.dat") if file is None else file att = scipy.io.readsav(_f) att_es, att_values = att["cmos_prefilter_transmission"]["energy_kev"][0] << u.keV, att["cmos_prefilter_transmission"][f"position{position}"][0] << u.dimensionless_unscaled diff --git a/response_tools/detector_response.py b/response_tools/detector_response.py index 60d7486..67ecf55 100644 --- a/response_tools/detector_response.py +++ b/response_tools/detector_response.py @@ -13,7 +13,7 @@ from response_tools.util import BaseOutput -DET_RESP_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "response-information", "detector-response-data") +DET_RESP_PATH = os.path.join(pathlib.Path(__file__).parent, "response-information", "detector-response-data") ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "det-resp-figs") @dataclass diff --git a/response_tools/effective_area.py b/response_tools/effective_area.py index d904ac8..22a8085 100644 --- a/response_tools/effective_area.py +++ b/response_tools/effective_area.py @@ -16,7 +16,7 @@ from response_tools.util import BaseOutput, native_resolution -EFF_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "response-information", "effective-area-data") +EFF_PATH = os.path.join(pathlib.Path(__file__).parent, "response-information", "effective-area-data") ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "eff-area-figs") @dataclass @@ -207,7 +207,7 @@ def _eff_area_msfc(mid_energies, file=None): # msfc_hi_res effective areas logging.warning(f"Caution: This might not be the function ({sys._getframe().f_code.co_name}) you are looking for, please see `eff_area_msfc_hi_res`.") logging.warning("This current function loads in some very early numbers for the new FOXSI-4 MSFC optics.") - _f = os.path.join(EFF_PATH, "3Inner_EA_EPDL97_14AA.csv") if file is None else file + _f = os.path.join(EFF_PATH, "3Inner_EA_EPDL97_14AA_v1.csv") if file is None else file msfc_hi_res = pandas.read_csv(_f).to_numpy()[:,1:] # remove the first column that only indexes # in cm2 ; we use the innermost and the 3rd innermost shells (S10 and S08) [from Yixian] msfc_hi_res_es, msfc_hi_res_effas08, msfc_hi_res_effas10 = msfc_hi_res[:,0] << u.keV, msfc_hi_res[:,1] << u.cm**2, msfc_hi_res[:,3] << u.cm**2 @@ -234,7 +234,7 @@ def _eff_area_nagoya(mid_energies, file=None): # nagoya sxr effective areas logging.warning(f"Caution: This might not be the function ({sys._getframe().f_code.co_name}) you are looking for and has other effects included than just optics.") logging.warning("This current function loads in some very early numbers for the new FOXSI-4 Nagoya SXR optics.") - _f = os.path.join(EFF_PATH, "effective-area_raytracing_soft-xray-optic_on-axis.txt") if file is None else file + _f = os.path.join(EFF_PATH, "effective-area_raytracing_soft-xray-optic_on-axis_v1.txt") if file is None else file nagoya_sxr = np.loadtxt(_f) nagoya_sxr_es, nagoya_sxr_effa = nagoya_sxr[:,0] << u.keV, nagoya_sxr[:,1]/100 << u.cm**2 diff --git a/response_tools/io/fetch_response_data.py b/response_tools/io/fetch_response_data.py index 7c67718..216fcc4 100644 --- a/response_tools/io/fetch_response_data.py +++ b/response_tools/io/fetch_response_data.py @@ -169,7 +169,7 @@ def verbose_print(*something): server_url += "/" # directory on local filesystem for saving data: - local_info_dir = os.path.abspath(os.path.join(__file__, "..", "..", "..", "response-information")) + local_info_dir = os.path.abspath(os.path.join(__file__, "..", "..", "response-information")) verbose_print("Retrieving response products from:", green_str(server_url)) verbose_print("Saving response products to:", green_str(local_info_dir)) diff --git a/response_tools/io/load_yaml.py b/response_tools/io/load_yaml.py index 2bda7ad..9fe73a6 100644 --- a/response_tools/io/load_yaml.py +++ b/response_tools/io/load_yaml.py @@ -16,4 +16,4 @@ def load_yaml(filename): def load_response_context(): """Function to load in the context information from file. """ - return load_yaml(os.path.join(pathlib.Path(__file__).parent, "..", "..", "response-information", "info.yaml")) \ No newline at end of file + return load_yaml(os.path.join(pathlib.Path(__file__).parent, "..", "response-information", "info.yaml")) \ No newline at end of file diff --git a/response_tools/quantum_efficiency.py b/response_tools/quantum_efficiency.py index 7ec72b7..5903f3d 100644 --- a/response_tools/quantum_efficiency.py +++ b/response_tools/quantum_efficiency.py @@ -12,7 +12,7 @@ from response_tools.util import BaseOutput, native_resolution -Q_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "response-information", "quantum-efficiency-data") +Q_PATH = os.path.join(pathlib.Path(__file__).parent, "response-information", "quantum-efficiency-data") ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "quantum-eff-figs") @dataclass diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 28d2a44..0000000 --- a/tests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `response-tools` - -Please put Python tests in here. From aaca55ddd4c307cd5f5726e01638a133a9249aa9 Mon Sep 17 00:00:00 2001 From: Kristopher Cooper Date: Mon, 29 Sep 2025 11:54:56 -0500 Subject: [PATCH 5/7] new data file location --- response_tools/response-information/README.md | 162 ++++++++++++++++++ response_tools/response-information/info.yaml | 44 +++++ 2 files changed, 206 insertions(+) create mode 100644 response_tools/response-information/README.md create mode 100644 response_tools/response-information/info.yaml diff --git a/response_tools/response-information/README.md b/response_tools/response-information/README.md new file mode 100644 index 0000000..afee3cc --- /dev/null +++ b/response_tools/response-information/README.md @@ -0,0 +1,162 @@ +# Response information + +This directory contains general information on the the response elements. + +## Response element description + +We will list the files here (same as on the repository's main README) but also show the original file names that are not consistently version so the mapping is always known. + +When a newer version of a file comes along, the text describing any old file can be added to the "Old response element description" section and the new information added here. + +### Position 0 (SXR, CMOS1) + +- **Optical blocking filter:** `"foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_v1.fits"` + - _Original file:_ `"foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Collimator:** `"foxsi4_telescope-0_BASIC_collimator_aperture_ratio_v1.fits"` + - _Original file:_ `"foxsi4_telescope-0_BASIC_collimator_aperture_ratio_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Optics:** `"foxsi4_telescope-0_BASIC_mirror_effective_area_v1.fits"` + - _Original file:_ `"foxsi4_telescope-0_BASIC_mirror_effective_area_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Filter:** `"foxsi4_telescope-0_BASIC_attenuation_filter_transmittance_v1.fits"` + - _Original file:_ `"foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Quantum efficiency:** `"foxsi4_telescope-0_BASIC_sensor_quantum_efficiency_v1.fits"` + - _Original file:_ `"foxsi4_telescope-0_BASIC_sensor_quantum_efficiency_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Detector response:** `"foxsi4_telescope-0_BASIC_RESPONSE_MATRIX_v1.fits"` + - _Original file:_ `"foxsi4_telescope-0_BASIC_RESPONSE_MATRIX_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ + +### Position 1 (SXR, CMOS2) + +- **Optical blocking filter:** `"foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_v1.fits"` + - _Original file:_ `"foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Collimator:** `"foxsi4_telescope-1_BASIC_collimator_aperture_ratio_v1.fits"` + - _Original file:_ `"foxsi4_telescope-1_BASIC_collimator_aperture_ratio_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Optics:** `"foxsi4_telescope-1_BASIC_mirror_effective_area_v1.fits"` + - _Original file:_ `"foxsi4_telescope-1_BASIC_mirror_effective_area_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Filter:** `"foxsi4_telescope-1_BASIC_attenuation_filter_transmittance_v1.fits"` + - _Original file:_ `"foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Quantum efficiency:** `"foxsi4_telescope-1_BASIC_sensor_quantum_efficiency_v1.fits"` + - _Original file:_ `"foxsi4_telescope-1_BASIC_sensor_quantum_efficiency_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ +- **Detector response:** `"foxsi4_telescope-1_BASIC_RESPONSE_MATRIX_v1.fits"` + - _Original file:_ `"foxsi4_telescope-1_BASIC_RESPONSE_MATRIX_V25APR13.fits"` + - _Origin:_ From [cmos-tools](https://github.com/foxsi/cmos-tools), introduced on 2025 April 17 in [PR#11](https://github.com/foxsi/cmos-tools/pull/11) + - _Version description:_ + +### Position 2 (HXR, CdTe4) + +- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` + - _Original file:_ `"F4_Blanket_transmission.dat"` + - _Origin:_ Uses [see Morgan] + - _Version description:_ +- **Optics:** `"FOXSI3_Module_X-7_EA_pan_v1.txt"` & `"FOXSI3_Module_X-7_EA_tilt_v1.txt"` (Marshall 10-shell X-7) + - _Original file:_ `"FOXSI3_Module_X-7_EA_pan.txt"` & `"FOXSI3_Module_X-7_EA_tilt.txt"` + - _Origin:_ The original `foxsi-science` [Github repository](https://github.com/foxsi/foxsi-science/tree/master/calibration_data). + - _Version description:_ +- **Filter:** `"unif_att_p2_theoretical_v1.csv"` (Al 0.015") + - _Original file:_ `"unif_att_p2_theoretical.csv"` + - _Origin:_ In the Google Drive `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Uniform attenuators (theoretical)` + - _Version description:_ +- **Detector response:** "" + +### Position 3 (HXR, CdTe2) + +- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` + - _Original file:_ `"F4_Blanket_transmission.dat"` + - _Origin:_ Uses [see Morgan] + - _Version description:_ +- **Optics:** `"FOXSI4_Module_MSFC_HiRes_EA_with_models_v1.txt"` (Marshall 2-shell X09/FM2) + - _Original file:_ `"FOXSI4_Effective_Areas_2025April11.txt"`[*](../response_tools/aux) + - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Optics`>`msfc-hi-res`>`model-data-comparison` + - _Version description:_ +- **Filter:** `"thin_mylar_p3_p5_theoretical_v1.csv"` + - _Original file:_ `"thin_mylar_p3_p5_theoretical.csv"` + - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Aluminized mylar detector window` + - _Version description:_ +- **Pixelated attenuator:** `"20240607_fosxi4_transmission_v1.csv"` + - _Original file:_ `"20240607_fosxi4_transmission.csv"` + - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Attenuator data analysis`>`gsfc_foxsi_attenuator_analysis` + - _Version description:_ +- **Detector response:** "" + +### Position 4 (HXR, CdTe3) + +- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` + - _Original file:_ `"F4_Blanket_transmission.dat"` + - _Origin:_ Uses [see Morgan] + - _Version description:_ +- **Optics:** `"nagoya_hxt_onaxis_measurement_v1.txt"` (Nagoya 1-shell HXT) + - _Original file:_ `"gain-corrrection_focused_incident_0.0207951x-plus--0.0552269_to_0.0207959x-plus--0.0492531_grpmin1000_Be_focused300.0s_incident300.0s_plot.txt"` + - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Optics`>`Nagoya_optics`>`on-axis_effective_area_measurement`>`HXR`>`on-axis_EA` + - _Version description:_ HXR on-axis. +- **Filter:** `"unif_att_p4_theoretical_v1.csv"` (Al 0.015") + - _Original file:_ `"unif_att_p4_theoretical.csv"` + - _Origin:_ In the Google Drive `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Uniform attenuators (theoretical)` +- **Detector response:** "" + +### Position 5 (HXR, CdTe1) + +- **Thermal blanket:** `"F4_Blanket_transmission_v1.dat"` + - _Original file:_ `"F4_Blanket_transmission.dat"` + - _Origin:_ Uses [see Morgan] + - _Version description:_ +- **Optics:** `"FOXSI3_Module_X-8_EA_pan_v1.txt"` & `"FOXSI3_Module_X-8_EA_tilt_v1.txt"` (Marshall 10-shell X-8) + - _Original file:_ `"FOXSI3_Module_X-8_EA_pan.txt"` & `"FOXSI3_Module_X-8_EA_tilt.txt"` + - _Origin:_ The original `foxsi-science` [Github repository](https://github.com/foxsi/foxsi-science/tree/master/calibration_data). + - _Version description:_ +- **Filter:** `"thin_mylar_p3_p5_theoretical_v1.csv"` + - _Original file:_ `"thin_mylar_p3_p5_theoretical.csv"` + - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Aluminized mylar detector window` + - _Version description:_ +- **Pixelated attenuator:** `"20240607_fosxi4_transmission_v1.csv"` + - _Original file:_ `"20240607_fosxi4_transmission.csv"` + - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Flight Science`>`Response Work`>`Attenuator data analysis`>`gsfc_foxsi_attenuator_analysis` + - _Version description:_ +- **Detector response:** "" + +### Position 6 (Timepix) + +- N/A + +## Old response element descriptions + +### Other response files + +This could include old files used in the pre-launch stage, intermediate, or unused products. + +These will likely be untracked by file versions but might be useful at some point. + +These files are: + +- `"foxsi4_telescope-N_BASIC_TELESCOPE_RESPONSE_V25APR13.fits"` + - `N` will be `0` or `1`, depending on the CMOS position of interest. + - This is an initial file that pre-combines a bunch of response elements to create an ARF-like file. +- `"CMOST_Prefilter_transmission.dat"` + - Early CMOS pre-filter values used in pre-launch simulations. +- `"3Inner_EA_EPDL97_14AA.csv"` + - Early MSCF hi-res effective areas used in pre-launch simulations. +- `"effective-area_raytracing_soft-xray-optic_on-axis.txt"` + - Early Nagoya SXR hi-res effective areas used in pre-launch simulations. +- **Optics:** `"nagoya_sxt_onaxis_measurement_v1.txt"` (Nagoya 1-shell HXT) + - _Original file:_ `"focused_incident_grpmin1000_C1_focused1800.0s_incident1800.0s_plot.txt"` + - _Origin:_ `FOXSI`>`FOXSI-4 Flight 36.370`>`Optics`>`Nagoya_optics`>`on-axis_effective_area_measurement`>`SXR`>`on-axis_EA` + - _Version description:_ SXR on-axis. diff --git a/response_tools/response-information/info.yaml b/response_tools/response-information/info.yaml new file mode 100644 index 0000000..3e14ae3 --- /dev/null +++ b/response_tools/response-information/info.yaml @@ -0,0 +1,44 @@ +files: + optics: + eff_area_telescope-2-pan_msfc_heritage: "effective-area-data/FOXSI3_Module_X-7_EA_pan_v1.txt" + eff_area_telescope-2-tilt_msfc_heritage: "effective-area-data/FOXSI3_Module_X-7_EA_tilt_v1.txt" + eff_area_telescope-5-pan_msfc_heritage: "effective-area-data/FOXSI3_Module_X-8_EA_pan_v1.txt" + eff_area_telescope-5-tilt_msfc_heritage: "effective-area-data/FOXSI3_Module_X-8_EA_tilt_v1.txt" + eff_area_msfc_hi_res: "effective-area-data/FOXSI4_Module_MSFC_HiRes_EA_with_models_v1.txt" + eff_area_measured_nagoya_hxt: "effective-area-data/nagoya_hxt_onaxis_measurement_v1.txt" + eff_area_measured_sxt: "effective-area-data/nagoya_sxt_onaxis_measurement_v1.txt" + eff_area_cmos_mirror0: "effective-area-data/foxsi4_telescope-0_BASIC_mirror_effective_area_v1.fits" + eff_area_cmos_mirror1: "effective-area-data/foxsi4_telescope-1_BASIC_mirror_effective_area_v1.fits" + eff_area_cmos_telescope0: "effective-area-data/foxsi4_telescope-0_BASIC_TELESCOPE_RESPONSE_v1.fits" + eff_area_cmos_telescope1: "effective-area-data/foxsi4_telescope-1_BASIC_TELESCOPE_RESPONSE_v1.fits" + eff_area_early_nagoya_sxt: "effective-area-data/effective-area_raytracing_soft-xray-optic_on-axis_v1.txt" + eff_area_early_msfc_hi_res: "effective-area-data/3Inner_EA_EPDL97_14AA_v1.csv" + eff_area_modeled_nagoya_hxt: "effective-area-data/HXR_Nagoya_FOXSI4_v1.arf" + eff_area_modeled_nagoya_sxt: "effective-area-data/SXR_nocollimator_noobf_v1.arf" + + detectors: + cmos_det_telescope-0_resp: "detector-response-data/cmos/foxsi4_telescope-0_BASIC_RESPONSE_MATRIX_v1.fits" + cmos_det_telescope-1_resp: "detector-response-data/cmos/foxsi4_telescope-1_BASIC_RESPONSE_MATRIX_v1.fits" + + attenuation: + att_thermal_blanket: "attenuation-data/F4_Blanket_transmission_v1.dat" + att_pixelated: "attenuation-data/20240607_fosxi4_transmission_v1.csv" + att_al_mylar: "attenuation-data/thin_mylar_p3_p5_theoretical_v1.csv" + att_telescope-2_uniform_al_cdte: "attenuation-data/unif_att_p2_theoretical_v1.csv" + att_telescope-4_uniform_al_cdte: "attenuation-data/unif_att_p4_theoretical_v1.csv" + att_telescope-0_collimator_ratio: "attenuation-data/foxsi4_telescope-0_BASIC_collimator_aperture_ratio_v1.fits" + att_telescope-1_collimator_ratio: "attenuation-data/foxsi4_telescope-1_BASIC_collimator_aperture_ratio_v1.fits" + att_telescope-0_cmos_obfilter: "attenuation-data/foxsi4_telescope-0_BASIC_optical_blocking_filter_transmittance_v1.fits" + att_telescope-1_cmos_obfilter: "attenuation-data/foxsi4_telescope-1_BASIC_optical_blocking_filter_transmittance_v1.fits" + att_telescope-0_cmos_prefilter: "attenuation-data/foxsi4_telescope-0_BASIC_attenuation_filter_transmittance_v1.fits" + att_telescope-1_cmos_prefilter: "attenuation-data/foxsi4_telescope-1_BASIC_attenuation_filter_transmittance_v1.fits" + att_foxsi4_atmosphere: "attenuation-data/FOXSI4_atmospheric_transmission_v1.fits" + att_early_cmos_prefilter: "attenuation-data/CMOST_Prefilter_transmission_v1.dat" + + quantum_efficiency: + qe_cmos_telescope-0: "quantum-efficiency-data/foxsi4_telescope-0_BASIC_sensor_quantum_efficiency_v1.fits" + qe_cmos_telescope-1: "quantum-efficiency-data/foxsi4_telescope-1_BASIC_sensor_quantum_efficiency_v1.fits" + +# remote URL for fetching data. +# can validly append any filename above to the server name to access. +remote_server: "http://foxsi.space.umn.edu/data/response/response-components" From 5c55d928838eaeb1f65c9175f15731039b239da3 Mon Sep 17 00:00:00 2001 From: Kristopher Cooper Date: Mon, 29 Sep 2025 12:22:05 -0500 Subject: [PATCH 6/7] att and eff_area functions now rely on YAML --- response_tools/attenuation.py | 22 +++++++------- response_tools/effective_area.py | 30 ++++++++++--------- response_tools/response-information/info.yaml | 2 +- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/response_tools/attenuation.py b/response_tools/attenuation.py index 1e4559f..bcf79d4 100644 --- a/response_tools/attenuation.py +++ b/response_tools/attenuation.py @@ -13,9 +13,11 @@ import pandas import scipy +import response_tools from response_tools.util import BaseOutput, native_resolution -ATT_PATH = os.path.join(pathlib.Path(__file__).parent, "response-information", "attenuation-data") +FILE_PATH = response_tools.responseFilePath +RESPONSE_INFO_TYPE = response_tools.contextResponseInfo["files"]["attenuation"] ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "att-figs") @dataclass @@ -56,7 +58,7 @@ def att_thermal_blanket(mid_energies, file=None): transmissions, and more. See accessible information using `.contents` on the output. """ - _f = os.path.join(ATT_PATH, "F4_Blanket_transmission_v1.dat") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE["att_thermal_blanket"]) if file is None else file att = scipy.io.readsav(_f) att_es, att_values = att["energy_kev"] << u.keV, att["f4_transmission"] << u.dimensionless_unscaled mid_energies = native_resolution(native_x=att_es, input_x=mid_energies) @@ -104,7 +106,7 @@ def att_uniform_al_cdte(mid_energies, position=None, file=None): """ if (position is None) or (position not in [2,4]): logging.warning(f"The {sys._getframe().f_code.co_name} `position` must be 2 or 4.") - _f = os.path.join(ATT_PATH, f"unif_att_p{position}_theoretical_v1.csv") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE[f"att_telescope-{position}_uniform_al_cdte"]) if file is None else file att = pandas.read_csv(_f) att_es, att_values = att["energy[keV]"] << u.keV, att["transmission"] << u.dimensionless_unscaled mid_energies = native_resolution(native_x=att_es, input_x=mid_energies) @@ -150,7 +152,7 @@ def att_pixelated(mid_energies, use_model=False, file=None): transmissions, and more. See accessible information using `.contents` on the output. """ - _f = os.path.join(ATT_PATH, "20240607_fosxi4_transmission_v1.csv") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE["att_pixelated"]) if file is None else file att = pandas.read_csv(_f) att_es, att_values_measured, att_values_modelled = att["energy"] << u.keV, att["measured_transmission"] << u.dimensionless_unscaled, att["modeled_transmission"] << u.dimensionless_unscaled @@ -196,7 +198,7 @@ def att_al_mylar(mid_energies, file=None): transmissions, and more. See accessible information using `.contents` on the output. """ - _f = os.path.join(ATT_PATH, "thin_mylar_p3_p5_theoretical_v1.csv") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE["att_al_mylar"]) if file is None else file att = pandas.read_csv(_f) att_es, att_values = att["energy[keV]"] << u.keV, att["transmission"] << u.dimensionless_unscaled mid_energies = native_resolution(native_x=att_es, input_x=mid_energies) @@ -223,7 +225,7 @@ def _att_old_prefilter(mid_energies, position=None, file=None): if (position is None) or (position not in [0,1]): logging.warning(f"The {sys._getframe().f_code.co_name} `position` must be 0 or 1.") logging.warning(f"Caution: This might not be the function you are looking for ({sys._getframe().f_code.co_name}), please see `att_cmos_obfilter`.") - _f = os.path.join(ATT_PATH, "CMOST_Prefilter_transmission_v1.dat") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE["att_early_cmos_prefilter"]) if file is None else file att = scipy.io.readsav(_f) att_es, att_values = att["cmos_prefilter_transmission"]["energy_kev"][0] << u.keV, att["cmos_prefilter_transmission"][f"position{position}"][0] << u.dimensionless_unscaled @@ -303,7 +305,7 @@ def att_cmos_filter(mid_energies, telescope=None, file=None): if (telescope is None) or (telescope not in [0,1]): logging.warning(f"The `telescope` input in {sys._getframe().f_code.co_name} must be 0 or 1.") return - _f = os.path.join(ATT_PATH, f"foxsi4_telescope-{telescope}_BASIC_attenuation_filter_transmittance_v1.fits") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE[f"att_telescope-{telescope}_cmos_prefilter"]) if file is None else file with fits.open(_f) as hdul: es, t = hdul[2].data << u.keV, hdul[1].data << u.dimensionless_unscaled mid_energies = native_resolution(native_x=es, input_x=mid_energies) @@ -351,7 +353,7 @@ def att_cmos_obfilter(mid_energies, telescope=None, file=None): if (telescope is None) or (telescope not in [0,1]): logging.warning(f"The `telescope` input in {sys._getframe().f_code.co_name} must be 0 or 1.") return - _f = os.path.join(ATT_PATH, f"foxsi4_telescope-{telescope}_BASIC_optical_blocking_filter_transmittance_v1.fits") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE[f"att_telescope-{telescope}_cmos_obfilter"]) if file is None else file with fits.open(_f) as hdul: es, t = hdul[2].data << u.keV, hdul[1].data << u.dimensionless_unscaled mid_energies = native_resolution(native_x=es, input_x=mid_energies) @@ -398,7 +400,7 @@ def att_cmos_collimator_ratio(off_axis_angle, telescope=None, file=None): if (telescope is None) or (telescope not in [0,1]): logging.warning(f"The `telescope` input in {sys._getframe().f_code.co_name} must be 0 or 1.") return - _f = os.path.join(ATT_PATH, f"foxsi4_telescope-{telescope}_BASIC_collimator_aperture_ratio_v1.fits") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE[f"att_telescope-{telescope}_collimator_ratio"]) if file is None else file with fits.open(_f) as hdul: oa_angles, aperture_ratio = hdul[2].data << u.arcmin, hdul[1].data << u.dimensionless_unscaled off_axis_angle = native_resolution(native_x=oa_angles, input_x=off_axis_angle) @@ -471,7 +473,7 @@ def att_foxsi4_atmosphere(mid_energies, time_range=None, file=None): warnings.warn(f"{sys._getframe().f_code.co_name} `time_range` (convertable to astropy.units.seconds) should be of length 2.") return - _f = os.path.join(ATT_PATH, f"FOXSI4_atmospheric_transmission_v1.fits") if file is None else file + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE["att_foxsi4_atmosphere"]) if file is None else file with fits.open(_f) as hdul: native_times, native_energies, transmission = hdul[1].data["TIME"][0]< Date: Tue, 30 Sep 2025 17:00:39 -0500 Subject: [PATCH 7/7] More functions use the YAML file --- response_tools/detector_response.py | 9 +++++---- response_tools/quantum_efficiency.py | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/response_tools/detector_response.py b/response_tools/detector_response.py index 67ecf55..efe2029 100644 --- a/response_tools/detector_response.py +++ b/response_tools/detector_response.py @@ -11,8 +11,11 @@ import astropy.units as u import numpy as np +import response_tools from response_tools.util import BaseOutput +FILE_PATH = response_tools.responseFilePath +RESPONSE_INFO_TYPE = response_tools.contextResponseInfo["files"]["detectors"] DET_RESP_PATH = os.path.join(pathlib.Path(__file__).parent, "response-information", "detector-response-data") ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "det-resp-figs") @@ -176,10 +179,8 @@ def cmos_det_resp(file=None, telescope=None): if (telescope is None) or (telescope not in [0,1]): logging.warning(f"The `telescope` input in {sys._getframe().f_code.co_name} must be 0 or 1.") return - - _f = os.path.join(DET_RESP_PATH, - "cmos", - f"foxsi4_telescope-{telescope}_BASIC_RESPONSE_MATRIX_v1.fits") if file is None else file + + _f = os.path.join(FILE_PATH, RESPONSE_INFO_TYPE[f"cmos_det_telescope-{telescope}_resp"]) if file is None else file with fits.open(_f) as hdul: matrix, counts, energy = hdul[1].data<<(u.DN/u.ph), hdul[2].data<