From b7da4dbcebbc211496e56d34b0dbe6b3fd293ce3 Mon Sep 17 00:00:00 2001 From: Kristopher Cooper Date: Tue, 23 Sep 2025 17:04:09 -0500 Subject: [PATCH 1/3] Removed build folder --- .../build/lib/response_tools_py/__init__.py | 34 - .../build/lib/response_tools_py/att.py | 242 ------- .../build/lib/response_tools_py/det_resp.py | 310 --------- .../build/lib/response_tools_py/eff_area.py | 320 --------- .../lib/response_tools_py/io/__init__.py | 0 .../lib/response_tools_py/io/load_yaml.py | 19 - .../response_tools_py/io/tests/__init__.py | 0 .../build/lib/response_tools_py/ir-plots.py | 641 ------------------ .../build/lib/response_tools_py/phot_spec.py | 100 --- .../lib/response_tools_py/quantum_eff.py | 50 -- .../build/lib/response_tools_py/version.py | 3 - 11 files changed, 1719 deletions(-) delete mode 100644 response-tools-py/build/lib/response_tools_py/__init__.py delete mode 100644 response-tools-py/build/lib/response_tools_py/att.py delete mode 100644 response-tools-py/build/lib/response_tools_py/det_resp.py delete mode 100644 response-tools-py/build/lib/response_tools_py/eff_area.py delete mode 100644 response-tools-py/build/lib/response_tools_py/io/__init__.py delete mode 100644 response-tools-py/build/lib/response_tools_py/io/load_yaml.py delete mode 100644 response-tools-py/build/lib/response_tools_py/io/tests/__init__.py delete mode 100644 response-tools-py/build/lib/response_tools_py/ir-plots.py delete mode 100644 response-tools-py/build/lib/response_tools_py/phot_spec.py delete mode 100644 response-tools-py/build/lib/response_tools_py/quantum_eff.py delete mode 100644 response-tools-py/build/lib/response_tools_py/version.py diff --git a/response-tools-py/build/lib/response_tools_py/__init__.py b/response-tools-py/build/lib/response_tools_py/__init__.py deleted file mode 100644 index 3f5cdf0..0000000 --- a/response-tools-py/build/lib/response_tools_py/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Top level of the `response-tools-py` package. - -Namespace ---------- - -The base `response_tools_py` namespace includes: - -`~response_tools_py.contextResponseInfo` - The information stored in a YAML file that includes information from - the flight. - -`~response_tools_py.__version__` - The current version of the code as stated in the setup script. - -Examples --------- -# importing the module is as easy as: ->>> import response_tools_py - -# then accessing, e.g., the context information for the flight/flare ->>> print(response_tools_py.contextResponseInfo) -... - -# that can be accessed like a native Python dictionary ->>> print(response_tools_py.contextResponseInfo[""]) -... -""" - -from .version import __version__ -from response_tools_py.io.load_yaml import load_response_context - -# for global context info -contextResponseInfo = load_response_context() diff --git a/response-tools-py/build/lib/response_tools_py/att.py b/response-tools-py/build/lib/response_tools_py/att.py deleted file mode 100644 index e7ed8e8..0000000 --- a/response-tools-py/build/lib/response_tools_py/att.py +++ /dev/null @@ -1,242 +0,0 @@ -"""Code to load different attenuators. """ - -import logging -import os -import pathlib - -from astropy.io import fits -import astropy.units as u -import numpy as np -import pandas -import scipy - -# thermal blanket attenuation -@u.quantity_input(mid_energies=u.keV) -def att_thermal_blanket(mid_energies, file=None): - """Return thermal blanket transmittance interpolated to the given energies.""" - _f = os.path.join(pathlib.Path(__file__).parent, - "att-data", - "F4_Blanket_transmission.dat") 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 - return np.interp(mid_energies.value, att_es.value, att_values.value, left=0, right=1) << u.dimensionless_unscaled - -# thermal blanket attenuation -@u.quantity_input(mid_energies=u.keV) -def att_uniform_al_cdte(mid_energies, file=None, position=None): - """Return thermal blanket transmittance interpolated to the given energies.""" - if position is None: - logging.info("`position` must be 2 or 4.") - _f = os.path.join(pathlib.Path(__file__).parent, - "att-data", - f"unif_att_p{position}_theoretical.csv") 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 - return np.interp(mid_energies.value, att_es.value, att_values.value, left=0, right=1) << u.dimensionless_unscaled - -# pixelated attenuator attenuation -@u.quantity_input(mid_energies=u.keV) -def att_pixelated(mid_energies, file=None, values=None): - """Return pixelated attenuator transmittance interpolated to the given energies.""" - _f = os.path.join(pathlib.Path(__file__).parent, - "att-data", - "20240607_fosxi4_transmission.csv") 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 - - if values=="measured": - return np.interp(mid_energies.value, att_es.value, att_values_measured.value, left=0, right=1) << u.dimensionless_unscaled - elif values in ["modelled", "modeled"]: - return np.interp(mid_energies.value, att_es.value, att_values_modelled.value, left=0, right=1) << u.dimensionless_unscaled - else: - logging.info("`values` must be \"measured\" or \"modelled\" (or \"modeled\" for you Americans).") - -# aluminized mylar attenuation -@u.quantity_input(mid_energies=u.keV) -def att_al_mylar(mid_energies, file=None): - """Return aluminized mylar transmittance interpolated to the given energies.""" - _f = os.path.join(pathlib.Path(__file__).parent, - "att-data", - "thin_mylar_p3_p5_theoretical.csv") 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 - return np.interp(mid_energies.value, att_es.value, att_values.value, left=0, right=1) << u.dimensionless_unscaled - -# OBF attenuation -@u.quantity_input(mid_energies=u.keV) -def att_obf0(mid_energies, file=None): - """Return OBF0 transmittance interpolated to the given energies.""" - logging.warning("This might not be the function you are looking for, please see `att_cmos_obfilter`.") - _f = os.path.join(pathlib.Path(__file__).parent, - "att-data", - "CMOST_Prefilter_transmission.dat") if file is None else file - att = scipy.io.readsav(_f) - att_es, att_values = att["cmos_prefilter_transmission"]["energy_kev"][0], att["cmos_prefilter_transmission"]["position0"][0] - - # this attenuation acts weird because it stops noticably above 0 at 1 keV (the lower energy), so... - # assume same drop-off as OBF1 - _obf1_numbers = att_obf1(mid_energies, file=None).value - _ex_obf0_inds = np.nonzero(_obf1_numbersf4'), ('ENERG_HI', '>f4'), ('N_GRP', '>i2'), - ('F_CHAN', '>i4', (2,)), ('N_CHAN', '>i4', (2,)), ('MATRIX', '>i4', (2,))])) - - col2arr_py(data['F_CHAN']) - array([[ 0., 0.], - [ 0., 0.], - [ 0., 22.]]) - ## max row length of 2 so 2 columns, each row is an energy channel. - """ - - # this is the quicker way I have chosen to do in Python (this may be revised later but is ~30x faster than way below in Python) - max_len = np.max([len([r]) for r in data]) # find max row length - chan_array_py = np.array( - [[*[r], *(max_len - len([r])) * [0]] for r in data] - ) # make each row that length (padding with 0) - - return chan_array_py - -def vrmf2arr_py(data=None, n_grp_list=None, f_chan_array=None, n_chan_array=None): - """Takes redistribution parameters for each energy channel from a - .rmf file and returns it in the correct format. - - From: https://lost-contact.mit.edu/afs/physics.wisc.edu/home/craigm/lib/idl/spectral/vrmf2arr.pro - - **This original function is taken from Sunkit-spex** - - https://github.com/sunpy/sunkit-spex - - Parameters - ---------- - data : array/list-like object - Redistribution matrix parameter array/list from the .rmf file. Units are counts per photon. - Default : None - - no_of_channels : int - Number of entries is the total number of photon channels, the entries themselves show the total number - of count channels to which that photon channel contributes. - Default : None - - f_chan_array : numpy.array - The index of each sub-set channel from each energy bin from the .rmf file run through col2arr_py(). - Default : None - - n_chan_array : numpy.array - The number of sub-set channels in each index for each energy bin from the .rmf file run through col2arr_py(). - Default : None - - Returns - ------- - A 2D numpy array of the correctly ordered input data with dimensions of energy in the rows and channels in - the columns. - - Example - ------- - d_rmf = 'directory/' - f_rmf = 'file.rmf' - e_lo, e_hi, ngrp, fchan, nchan, matrix = det_io._read_rmf(d_rmf+f_rmf) - - fchan_array = nu_spec.col2arr_py(fchan) - nchan_array = nu_spec.col2arr_py(nchan) - - rmf = nu_spec.vrmf2arr_py(data=matrix, - n_grp_list=ngrp, - f_chan_array=fchan_array, - n_chan_array=nchan_array) - rmf - - array([[0.00033627, 0.0007369 , 0.00113175, ..., 0. , 0. , 0. ], - [0.00039195, 0.00079259, 0.00138341, ..., 0. , 0. , 0. ], - [0.00042811, 0.00083381, 0.00157794, ..., 0. , 0. , 0. ], - ..., - [0. , 0. , 0. , ..., 0.00408081, 0.00409889, 0.00403308], - [0. , 0. , 0. , ..., 0.00405333, 0.00413722, 0.00413216], - [0. , 0. , 0. , ..., 0. , 0. , 0. ]]) - ## rows = photon/energy channels, columns = counts channels - - What's Going On? - ---------------- - The RMF file has the photon-to-counts conversion information in it. - The martix has the photon-to-count conversion value for each count channel (columns) that is involved with theach photon channel (rows). - E.g., matrix = [ [a, b, c, d, e, f, ...] , - [ ... ] , - [ ... ] , - ... ] - F_chan is the starting index of contiguous counts channels that are involved with the photon channel. - E.g., f_chan = [ [0, 5, 0, 0, 0, ...] , - [ ... ] , - [ ... ] , - ... ] - For the first photon channel, there are rows of counts channels starting at index 0 and 5 - N_chan is the corresponding number of counts channels from each index in the f_chan array. - E.g., n_chan = [ [2, 3, 0, 0, 0, ...] , - [ ... ] , - [ ... ] , - ... ] - Starting at index 0 for the first photon channel we have the first 2 matrix values, then at index 5 we have the next 3. - The total of each row is the same as the n_grp_list and the number of entries in each row of the matrix entry. - Putting all this together, the rmf matrix is: - rmf_matrix = [ [a, b, 0, 0, 0, c , d , e, 0 , 0 , ...] , #<-- index 0 (f_chan) with 2 entries (n_chan) with photon-to-counts conversion (matrix) - [ ... ] , - [ ... ] , - ... ] - """ - # this was is about >6x quicker in than the IDL code written in Python - - n_grp_list = n_grp_list.astype("i2") to ‘little-endian’ ("=0 else 2 - _p = gs_ax2.plot(ea_energies, eff_area_msfc_10shell(ea_energies, off_axis=oaa<=0 else 2 - _p = gs_ax5.plot(ea_energies, eff_area_msfc_10shell(ea_energies, off_axis=oaa<=0 else 2 - _eff_areas = eff_area_msfc_10shell(mid_energies, off_axis=oaa<=0 else 2 - _eff_areas = eff_area_msfc_10shell(mid_energies, off_axis=oaa< Date: Wed, 24 Sep 2025 16:05:20 -0500 Subject: [PATCH 2/3] fixed some typos --- .../examples/functions_and_outputs.py | 46 +++++++++++++------ .../response_tools_py/responses.py | 36 +++++++++------ 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/response-tools-py/examples/functions_and_outputs.py b/response-tools-py/examples/functions_and_outputs.py index 7e40302..ba90ea6 100644 --- a/response-tools-py/examples/functions_and_outputs.py +++ b/response-tools-py/examples/functions_and_outputs.py @@ -8,7 +8,7 @@ - Thermal blanket -> Marshall 10-shell X-7 -> Al (0.015") -> CdTe4 Mainly a quick example on unit aware objects and how to access the -returned dataclass objects. +returned data-class objects. This example shows the use of nice high level functions that are tied to FOXSI-4 telescopes. @@ -128,13 +128,13 @@ when necessary. The output of `pos2_optics` (an `pos2_optics_new`) isn't just an array -now, it's a dataclass. The dataclass contains the effective areas of the -optics but also the energy, file, off-axis angle information used to +now, it's a data-class. The data-class contains the effective areas of +the optics but also the energy, file, off-axis angle information used to produce it. This is crucial to track when there are a lot of files flying around. As suggested in the "Output" section of the helpful documentation -earlier, we can see the contents of the dataclass and how to access the +earlier, we can see the contents of the data-class and how to access the information within it: """ @@ -164,11 +164,28 @@ 'model': False} ``` +The above might be a bit cumbersome and you may only wish to look at the +data fields contained in the output. For this we can simply run: +""" +print(pos2_optics.fields) +""" +yielding something like: +``` +['filename', + 'function_path', + 'mid_energies', + 'off_axis_angle', + 'effective_areas', + 'optic_id', + 'model'] +``` +which might be a bit easier to read. + Note: there is a method called `print_contents()` you can use on the function output that might format the contents a little nicer than the above you may wish to use. -Each field can be accessed with the displayed name. For excample, to get +Each field can be accessed with the displayed name. For example, to get the effective areas of the optics, simply: """ @@ -184,10 +201,11 @@ Redistribution Matrix Function (RMF), and/or Detector Response Matrix (DRM). -First, we can get the RMF for a telescope, say, Telescope 2: +First, we can get the RMF for a telescope, say, Telescope 2 to be +consistent with using position 2's components previously: """ -pos2_rmf = responses.foxsi4_telescope2_rmf(region=0) +tel2_rmf = responses.foxsi4_telescope2_rmf(region=0) """ The `region` input refers to the different pitch regions across the CdTe @@ -200,9 +218,9 @@ the ARF values for: """ -mid_energies = (pos2_rmf.input_energy_edges[:-1]\ - +pos2_rmf.input_energy_edges[1:])/2 -pos2_arf = responses.foxsi4_telescope2_arf(mid_energies=mid_energies, +mid_energies = (tel2_rmf.input_energy_edges[:-1]\ + +tel2_rmf.input_energy_edges[1:])/2 +tel2_arf = responses.foxsi4_telescope2_arf(mid_energies=mid_energies, off_axis_angle=0< Date: Wed, 24 Sep 2025 16:28:37 -0500 Subject: [PATCH 3/3] restructure to Python-only package --- .gitignore | 2 +- README.md | 98 ++++++++++++------ .../att-figs/atmospheric-transmissions.png | Bin .../att-figs/model-transmissions.png | Bin .../att-figs/transmissions.png | Bin .../det-resp-figs/cdte-response-matrix.png | Bin .../det-resp-figs/cmos-response-matrices.png | Bin .../eff-area-figs/cmos-optics-resp.png | Bin .../heritage-and-msfc-optics.png | Bin .../quantum-eff-figs/cmos-qunatum-eff.png | Bin .../response-figs/response-chain.png | Bin .../response-hit-combinations.png | Bin .../response-paths/Pos_0_CMOS_1_Response.png | Bin .../response-paths/Pos_1_CMOS_2_Response.png | Bin .../response-paths/Pos_2_CdTe_4_Response.png | Bin .../response-paths/Pos_3_CdTe_2_Response.png | Bin .../response-paths/Pos_4_CdTe_3_Response.png | Bin .../response-paths/Pos_5_CdTe_1_Response.png | Bin examples/README.md | 14 ++- .../functions_and_outputs.py | 6 +- .../examples => examples}/plot_arf_rmf_drm.py | 2 +- response-information/README.md | 2 +- response-tools-py/README.md | 58 ----------- response-tools-py/examples/README.md | 13 --- .../response_tools_py/version.py | 3 - .../__init__.py | 16 +-- .../attenuation.py | 8 +- .../aux/README.md | 2 +- .../aux/format-msfc-eff-areas.py | 0 .../detector_response.py | 6 +- .../effective_area.py | 6 +- .../io/__init__.py | 0 .../io/load_yaml.py | 2 +- .../io/tests/README.md | 2 +- .../io/tests/__init__.py | 0 .../ir-plots.py | 2 +- .../phot_spec.py | 0 .../quantum_efficiency.py | 6 +- .../responses.py | 8 +- .../telescope_parts.py | 22 ++-- .../util.py | 0 response_tools/version.py | 3 + response-tools-py/setup.py => setup.py | 2 +- tests/README.md | 2 +- 44 files changed, 129 insertions(+), 156 deletions(-) rename assets/{response-tools-py-figs => response-tools-figs}/att-figs/atmospheric-transmissions.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/att-figs/model-transmissions.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/att-figs/transmissions.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/det-resp-figs/cdte-response-matrix.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/det-resp-figs/cmos-response-matrices.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/eff-area-figs/cmos-optics-resp.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/eff-area-figs/heritage-and-msfc-optics.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/quantum-eff-figs/cmos-qunatum-eff.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-figs/response-chain.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-figs/response-hit-combinations.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-paths/Pos_0_CMOS_1_Response.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-paths/Pos_1_CMOS_2_Response.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-paths/Pos_2_CdTe_4_Response.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-paths/Pos_3_CdTe_2_Response.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-paths/Pos_4_CdTe_3_Response.png (100%) rename assets/{response-tools-py-figs => response-tools-figs}/response-paths/Pos_5_CdTe_1_Response.png (100%) rename {response-tools-py/examples => examples}/functions_and_outputs.py (98%) rename {response-tools-py/examples => examples}/plot_arf_rmf_drm.py (98%) delete mode 100644 response-tools-py/README.md delete mode 100644 response-tools-py/examples/README.md delete mode 100644 response-tools-py/response_tools_py/version.py rename {response-tools-py/response_tools_py => response_tools}/__init__.py (57%) rename {response-tools-py/response_tools_py => response_tools}/attenuation.py (99%) rename {response-tools-py/response_tools_py => response_tools}/aux/README.md (97%) rename {response-tools-py/response_tools_py => response_tools}/aux/format-msfc-eff-areas.py (100%) rename {response-tools-py/response_tools_py => response_tools}/detector_response.py (99%) rename {response-tools-py/response_tools_py => response_tools}/effective_area.py (99%) rename {response-tools-py/response_tools_py => response_tools}/io/__init__.py (100%) rename {response-tools-py/response_tools_py => response_tools}/io/load_yaml.py (89%) rename {response-tools-py/response_tools_py => response_tools}/io/tests/README.md (56%) rename {response-tools-py/response_tools_py => response_tools}/io/tests/__init__.py (100%) rename {response-tools-py/response_tools_py => response_tools}/ir-plots.py (99%) rename {response-tools-py/response_tools_py => response_tools}/phot_spec.py (100%) rename {response-tools-py/response_tools_py => response_tools}/quantum_efficiency.py (94%) rename {response-tools-py/response_tools_py => response_tools}/responses.py (99%) rename {response-tools-py/response_tools_py => response_tools}/telescope_parts.py (97%) rename {response-tools-py/response_tools_py => response_tools}/util.py (100%) create mode 100644 response_tools/version.py rename response-tools-py/setup.py => setup.py (93%) diff --git a/.gitignore b/.gitignore index bd9ed0b..e4f75e7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ __pycache__/ .ipynb_checkpoints # Python -response_tools_py.egg-info/ +response_tools.egg-info/ build/ # data directories diff --git a/README.md b/README.md index d28110c..4cfedff 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,65 @@ Repository to manage response elements, originally for the FOXSI-4 sounding rock **Note:** Although this repositiory can be extanded to any other instrument (e.g., FOXSI-1, -2, and -3), this repository is only currently aimed for FOXSI-4 use. +## `response-tools` + +A repository to software tools for the response system used for the FOXSI mission in Python (woo, Python). We will include helpful loader functions for the all the response elements and download clients to obtain the files. + +The tools being developed in Python should be placed in the `response_tools` folder (note the underscores and not dashes). + +There is an "examples" and a "tests" folder. The "examples" folder is a great place to include scripts that show how some of the code in the repository works and the "tests" folder is a fantastic place to put code that tests the tools that have been created. + +More information will be placed here with regards as to how this package is recommended to be used. + +## Install tips + +In order to work with some preliminary data, it is instructive to set up a virtual environment (more information below) and install necessary packages. The suggested way to do this is to create an environment with: + +- `conda create -n response-tools-env python==3.12` + +(recommend using Python 3.12 just because this has been proven to be stable with the software). + +The Python code can then be installed with: + +- `pip install -e .` + +while in this directory (the `response-tools` directory) containing the `setup.py` file. + +Any time the code is updated and, say, you pull it from Github, make sure to perform the `pip install -e .` line from above. This ensures any new changes, updated versions, etc. take effect. + +## Namespace + +The base `response_tools` namespace includes: + +- `~response_tools.contextResponseInfo` + - The information stored in a [YAML file](../response-information/info.yaml) that includes file version information (e.g., the current versions to be used) and can be accessed like a Python dictionary. +- `~response_tools.__version__` + - The version of the code determined by `response-tools/setup.py`. + - `0.0.1`: First rendition of the code. + +### Examples using the namespace + +```python +# importing the module is as easy as: +>>> import response_tools + +# can access the YAML file contents in the code as +>>> print(response_tools.contextResponseInfo[""]) +... + +# then accessing the version as: +>>> print(response_tools.__version__) +'0.0.1' +``` + +## Useful Python tips + +Some useful things to keep in mind while using the Python code in this repository. + +### Virtual environments + +It might be a good idea to look into ([conda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)) virtual environments if you are not familiar, this includes looking into them yourself or getting in touch with someone to help explain. This requires downloading [miniconda](https://docs.anaconda.com/miniconda/install/#quick-command-line-install) (or just conda if you prefer). + ## Response files There are many response elements for FOXSI-4. Once downloaded, they can be places or found [here](./response-information/). @@ -26,7 +85,7 @@ For a historical description of the response files below (old versions, etc.), s - **Detector response:** "" - **Quantum efficiency:** "" -![Position 0 photon path](./assets/response-tools-py-figs/response-paths/Pos_0_CMOS_1_Response.png "Position 0 photon path") +![Position 0 photon path](./assets/response-tools-figs/response-paths/Pos_0_CMOS_1_Response.png "Position 0 photon path") ### Position 1 (SXR, CMOS2) @@ -37,7 +96,7 @@ For a historical description of the response files below (old versions, etc.), s - **Detector response:** "" - **Quantum efficiency:** "" -![Position 1 photon path](./assets/response-tools-py-figs/response-paths/Pos_1_CMOS_2_Response.png "Position 1 photon path") +![Position 1 photon path](./assets/response-tools-figs/response-paths/Pos_1_CMOS_2_Response.png "Position 1 photon path") ### Position 2 (HXR, CdTe4) @@ -46,7 +105,7 @@ For a historical description of the response files below (old versions, etc.), s - **Filter:** "" - **Detector response:** "" -![Position 2 photon path](./assets/response-tools-py-figs/response-paths/Pos_2_CdTe_4_Response.png "Position 2 photon path") +![Position 2 photon path](./assets/response-tools-figs/response-paths/Pos_2_CdTe_4_Response.png "Position 2 photon path") ### Position 3 (HXR, CdTe2) @@ -56,7 +115,7 @@ For a historical description of the response files below (old versions, etc.), s - **Pixelated attenuator:** "" - **Detector response:** "" -![Position 3 photon path](./assets/response-tools-py-figs/response-paths/Pos_3_CdTe_2_Response.png "Position 3 photon path") +![Position 3 photon path](./assets/response-tools-figs/response-paths/Pos_3_CdTe_2_Response.png "Position 3 photon path") ### Position 4 (HXR, CdTe3) @@ -65,7 +124,7 @@ For a historical description of the response files below (old versions, etc.), s - **Filter:** "" - **Detector response:** "" -![Position 4 photon path](./assets/response-tools-py-figs/response-paths/Pos_4_CdTe_3_Response.png "Position 4 photon path") +![Position 4 photon path](./assets/response-tools-figs/response-paths/Pos_4_CdTe_3_Response.png "Position 4 photon path") ### Position 5 (HXR, CdTe1) @@ -75,34 +134,17 @@ For a historical description of the response files below (old versions, etc.), s - **Pixelated attenuator:** "" - **Detector response:** "" -![Position 5 photon path](./assets/response-tools-py-figs/response-paths/Pos_5_CdTe_1_Response.png "Position 5 photon path") +![Position 5 photon path](./assets/response-tools-figs/response-paths/Pos_5_CdTe_1_Response.png "Position 5 photon path") ### Position 6 (Timepix) - N/A -## Software and software help - -The repository may make use of multiple languages and each folder like `response-tools-???` hosts code in their respective languages relating to response tools. These include: - -- [`response-tools-py`](response-tools-py/) which contains Python code to download and read in the response files. - - The README in this directory also contains Python specific information & help - ## Example code There are a few existing example scripts showing how to use a lot of tools in the repository. -**Python examples:** Python example scripts can be found in response-tools-py [examples](response-tools-py/examples/) folder which has an associated [README file](response-tools-py/examples/README.md). - -## Repository Aim - -This repository will contain all code that proves useful in loading FOXSI response elements (at least from FOXSI-4). Several languages might be used and so the top level will be to contain language specific packages. - -For example, the `response-tools-py` folder will be a Python package containing all the necessary `.py` files. If other languages are to be included, like `IDL`, then a folder called `response-tools-idl` should be created and used to contain all the `IDL`-ness of the repository. This standard can be applied to the inclusion of other languages (e.g., C++ as `response-tools-cpp`, Shell code as `response-tools-shell`, etc.). - -Every `response-tools-` folder should have an "examples" and a "tests" folder. The "examples" folder is a great place to include scripts that show how some of the code in the repository works and the "tests" folder is a fantastic place to put code that tests the tools that have been created. - -Additionally, there is also an "examples" and "tests" folder in the top level of the repository so there is a place for anything that fits these folders that spans across code from multiple languages. +**Python examples:** Python example scripts can be found in response-tools [examples](response-tools/examples/) folder which has an associated [README file](response-tools/examples/README.md). ## Contributing to the repository @@ -112,14 +154,6 @@ In order to contribute, we ask that you first create your own fork of the reposi **Note:** We aim to _never_ `push` from a local machine to this repository directly. If this happens then it can be very difficult for other contributers to understand what changes are being made and how it affects their own PRs. _If the repository is pushed to directly, in order to help track changes and make them visible to other contributers, the repository will be reverted back to it's state before the push and the undone changes will be asked to be proposed via a PR to then be merged._ -## The `external` directory - -The `external` directory is a place for software external to the repository. There is no guarentee that it will follow any specific coding language and so it would perhaps not be ideal to place it in a specific coding language `tools` directory. Some may be [`git` submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules). - -To clone submodules when cloning the main repository, try the following: - -- `git clone --recurse-submodules https://github.com/foxsi/response-tools.git` - ## The `response-information` directory This directory contains context information about the response files that can be shared between a lot of different scripts. E.g., the latest versions of the files the code should be using. diff --git a/assets/response-tools-py-figs/att-figs/atmospheric-transmissions.png b/assets/response-tools-figs/att-figs/atmospheric-transmissions.png similarity index 100% rename from assets/response-tools-py-figs/att-figs/atmospheric-transmissions.png rename to assets/response-tools-figs/att-figs/atmospheric-transmissions.png diff --git a/assets/response-tools-py-figs/att-figs/model-transmissions.png b/assets/response-tools-figs/att-figs/model-transmissions.png similarity index 100% rename from assets/response-tools-py-figs/att-figs/model-transmissions.png rename to assets/response-tools-figs/att-figs/model-transmissions.png diff --git a/assets/response-tools-py-figs/att-figs/transmissions.png b/assets/response-tools-figs/att-figs/transmissions.png similarity index 100% rename from assets/response-tools-py-figs/att-figs/transmissions.png rename to assets/response-tools-figs/att-figs/transmissions.png diff --git a/assets/response-tools-py-figs/det-resp-figs/cdte-response-matrix.png b/assets/response-tools-figs/det-resp-figs/cdte-response-matrix.png similarity index 100% rename from assets/response-tools-py-figs/det-resp-figs/cdte-response-matrix.png rename to assets/response-tools-figs/det-resp-figs/cdte-response-matrix.png diff --git a/assets/response-tools-py-figs/det-resp-figs/cmos-response-matrices.png b/assets/response-tools-figs/det-resp-figs/cmos-response-matrices.png similarity index 100% rename from assets/response-tools-py-figs/det-resp-figs/cmos-response-matrices.png rename to assets/response-tools-figs/det-resp-figs/cmos-response-matrices.png diff --git a/assets/response-tools-py-figs/eff-area-figs/cmos-optics-resp.png b/assets/response-tools-figs/eff-area-figs/cmos-optics-resp.png similarity index 100% rename from assets/response-tools-py-figs/eff-area-figs/cmos-optics-resp.png rename to assets/response-tools-figs/eff-area-figs/cmos-optics-resp.png diff --git a/assets/response-tools-py-figs/eff-area-figs/heritage-and-msfc-optics.png b/assets/response-tools-figs/eff-area-figs/heritage-and-msfc-optics.png similarity index 100% rename from assets/response-tools-py-figs/eff-area-figs/heritage-and-msfc-optics.png rename to assets/response-tools-figs/eff-area-figs/heritage-and-msfc-optics.png diff --git a/assets/response-tools-py-figs/quantum-eff-figs/cmos-qunatum-eff.png b/assets/response-tools-figs/quantum-eff-figs/cmos-qunatum-eff.png similarity index 100% rename from assets/response-tools-py-figs/quantum-eff-figs/cmos-qunatum-eff.png rename to assets/response-tools-figs/quantum-eff-figs/cmos-qunatum-eff.png diff --git a/assets/response-tools-py-figs/response-figs/response-chain.png b/assets/response-tools-figs/response-figs/response-chain.png similarity index 100% rename from assets/response-tools-py-figs/response-figs/response-chain.png rename to assets/response-tools-figs/response-figs/response-chain.png diff --git a/assets/response-tools-py-figs/response-figs/response-hit-combinations.png b/assets/response-tools-figs/response-figs/response-hit-combinations.png similarity index 100% rename from assets/response-tools-py-figs/response-figs/response-hit-combinations.png rename to assets/response-tools-figs/response-figs/response-hit-combinations.png diff --git a/assets/response-tools-py-figs/response-paths/Pos_0_CMOS_1_Response.png b/assets/response-tools-figs/response-paths/Pos_0_CMOS_1_Response.png similarity index 100% rename from assets/response-tools-py-figs/response-paths/Pos_0_CMOS_1_Response.png rename to assets/response-tools-figs/response-paths/Pos_0_CMOS_1_Response.png diff --git a/assets/response-tools-py-figs/response-paths/Pos_1_CMOS_2_Response.png b/assets/response-tools-figs/response-paths/Pos_1_CMOS_2_Response.png similarity index 100% rename from assets/response-tools-py-figs/response-paths/Pos_1_CMOS_2_Response.png rename to assets/response-tools-figs/response-paths/Pos_1_CMOS_2_Response.png diff --git a/assets/response-tools-py-figs/response-paths/Pos_2_CdTe_4_Response.png b/assets/response-tools-figs/response-paths/Pos_2_CdTe_4_Response.png similarity index 100% rename from assets/response-tools-py-figs/response-paths/Pos_2_CdTe_4_Response.png rename to assets/response-tools-figs/response-paths/Pos_2_CdTe_4_Response.png diff --git a/assets/response-tools-py-figs/response-paths/Pos_3_CdTe_2_Response.png b/assets/response-tools-figs/response-paths/Pos_3_CdTe_2_Response.png similarity index 100% rename from assets/response-tools-py-figs/response-paths/Pos_3_CdTe_2_Response.png rename to assets/response-tools-figs/response-paths/Pos_3_CdTe_2_Response.png diff --git a/assets/response-tools-py-figs/response-paths/Pos_4_CdTe_3_Response.png b/assets/response-tools-figs/response-paths/Pos_4_CdTe_3_Response.png similarity index 100% rename from assets/response-tools-py-figs/response-paths/Pos_4_CdTe_3_Response.png rename to assets/response-tools-figs/response-paths/Pos_4_CdTe_3_Response.png diff --git a/assets/response-tools-py-figs/response-paths/Pos_5_CdTe_1_Response.png b/assets/response-tools-figs/response-paths/Pos_5_CdTe_1_Response.png similarity index 100% rename from assets/response-tools-py-figs/response-paths/Pos_5_CdTe_1_Response.png rename to assets/response-tools-figs/response-paths/Pos_5_CdTe_1_Response.png diff --git a/examples/README.md b/examples/README.md index 62925cd..5637cc9 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,3 +1,13 @@ -# `cdte-tools` +# `response-tools` Examples -Please put examples spanning multiple languages in here. +This module contains functions to handle the visualization of the various response data products. + +## 1. Data handling examples + +- [using_the_functions.py](./functions_and_outputs.py) + - Shows how to use the functions and their outputs in the package. + +## 2. Plotting examples + +- [plot_arf_rmf_drm.py](./plot_arf_rmf_drm.py) + - Shows how to obtain and plot the ARF, RMF, and DRM for Telescope 2. diff --git a/response-tools-py/examples/functions_and_outputs.py b/examples/functions_and_outputs.py similarity index 98% rename from response-tools-py/examples/functions_and_outputs.py rename to examples/functions_and_outputs.py index ba90ea6..1a42225 100644 --- a/response-tools-py/examples/functions_and_outputs.py +++ b/examples/functions_and_outputs.py @@ -46,8 +46,8 @@ (DRM). """ -import response_tools_py.responses as responses -import response_tools_py.telescope_parts as telescope_parts +import response_tools.responses as responses +import response_tools.telescope_parts as telescope_parts """ Let's look at the `foxsi4_position2_optics` function since we mentioned @@ -57,7 +57,7 @@ ``` >>> help(telescope_parts.foxsi4_position2_optics) Help on function foxsi4_position2_optics in module -response_tools_py.telescope_parts: +response_tools.telescope_parts: foxsi4_position2_optics(mid_energies, off_axis_angle) Position 2 MSFC heritage X-7 optic effective areas. diff --git a/response-tools-py/examples/plot_arf_rmf_drm.py b/examples/plot_arf_rmf_drm.py similarity index 98% rename from response-tools-py/examples/plot_arf_rmf_drm.py rename to examples/plot_arf_rmf_drm.py index 3bee15f..6bbd1e1 100644 --- a/response-tools-py/examples/plot_arf_rmf_drm.py +++ b/examples/plot_arf_rmf_drm.py @@ -23,7 +23,7 @@ import matplotlib.pyplot as plt import numpy as np -import response_tools_py.responses as responses +import response_tools.responses as responses fig = plt.figure(figsize=(18, 5)) gs = gridspec.GridSpec(1, 3) diff --git a/response-information/README.md b/response-information/README.md index a3af295..afee3cc 100644 --- a/response-information/README.md +++ b/response-information/README.md @@ -85,7 +85,7 @@ When a newer version of a file comes along, the text describing any old file can - _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-py/response_tools_py/aux) + - _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"` diff --git a/response-tools-py/README.md b/response-tools-py/README.md deleted file mode 100644 index 551d482..0000000 --- a/response-tools-py/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# `response-tools-py` - -A repository to software tools for the response system used for the FOXSI mission in Python (woo, Python). We will include helpful loader functions for the all the response elements and download clients to obtain the files. - -The tools being developed in Python should be placed in the `response_tools_py` folder (note the underscores and not dashes). - -There is an "examples" and a "tests" folder. The "examples" folder is a great place to include scripts that show how some of the code in the repository works and the "tests" folder is a fantastic place to put code that tests the tools that have been created. - -More information will be placed here with regards as to how this package is recommended to be used. - -## Install tips - -In order to work with some preliminary data, it is instructive to set up a virtual environment (more information below) and install necessary packages. The suggested way to do this is to create an environment with: - -- `conda create -n response-tools-env python==3.12` - -(recommend using Python 3.12 just because this has been proven to be stable with the software). - -The Python code can then be installed with: - -- `pip install -e .` - -while in this directory (the `response-tools-py` directory) containing the `setup.py` file. - -Any time the code is updated and, say, you pull it from Github, make sure to perform the `pip install -e .` line from above. This ensures any new changes, updated versions, etc. take effect. - -## Namespace - -The base `response_tools_py` namespace includes: - -- `~response_tools_py.contextResponseInfo` - - The information stored in a [YAML file](../response-information/info.yaml) that includes file version information (e.g., the current versions to be used) and can be accessed like a Python dictionary. -- `~response_tools_py.__version__` - - The version of the code determined by `response-tools-py/setup.py`. - - `0.0.1`: First rendition of the code. - -### Examples using the namespace - -```python -# importing the module is as easy as: ->>> import response_tools_py - -# can access the YAML file contents in the code as ->>> print(response_tools_py.contextResponseInfo[""]) -... - -# then accessing the version as: ->>> print(response_tools_py.__version__) -'0.0.1' -``` - -## Useful Python tips - -Some useful things to keep in mind while using the Python code in this repository. - -### Virtual environments - -It might be a good idea to look into ([conda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)) virtual environments if you are not familiar, this includes looking into them yourself or getting in touch with someone to help explain. This requires downloading [miniconda](https://docs.anaconda.com/miniconda/install/#quick-command-line-install) (or just conda if you prefer). diff --git a/response-tools-py/examples/README.md b/response-tools-py/examples/README.md deleted file mode 100644 index 82e351f..0000000 --- a/response-tools-py/examples/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# `response-tools-py` Examples - -This module contains functions to handle the visualization of the various response data products. - -## 1. Data handling examples - -- [using_the_functions.py](./functions_and_outputs.py) - - Shows how to use the functions and their outputs in the package. - -## 2. Plotting examples - -- [plot_arf_rmf_drm.py](./plot_arf_rmf_drm.py) - - Shows how to obtain and plot the ARF, RMF, and DRM for Telescope 2. diff --git a/response-tools-py/response_tools_py/version.py b/response-tools-py/response_tools_py/version.py deleted file mode 100644 index ef37232..0000000 --- a/response-tools-py/response_tools_py/version.py +++ /dev/null @@ -1,3 +0,0 @@ -import importlib.metadata - -__version__ = importlib.metadata.version("response_tools_py") diff --git a/response-tools-py/response_tools_py/__init__.py b/response_tools/__init__.py similarity index 57% rename from response-tools-py/response_tools_py/__init__.py rename to response_tools/__init__.py index 3f5cdf0..fea117f 100644 --- a/response-tools-py/response_tools_py/__init__.py +++ b/response_tools/__init__.py @@ -1,34 +1,34 @@ """ -Top level of the `response-tools-py` package. +Top level of the `response-tools` package. Namespace --------- -The base `response_tools_py` namespace includes: +The base `response_tools` namespace includes: -`~response_tools_py.contextResponseInfo` +`~response_tools.contextResponseInfo` The information stored in a YAML file that includes information from the flight. -`~response_tools_py.__version__` +`~response_tools.__version__` The current version of the code as stated in the setup script. Examples -------- # importing the module is as easy as: ->>> import response_tools_py +>>> import response_tools # then accessing, e.g., the context information for the flight/flare ->>> print(response_tools_py.contextResponseInfo) +>>> print(response_tools.contextResponseInfo) ... # that can be accessed like a native Python dictionary ->>> print(response_tools_py.contextResponseInfo[""]) +>>> print(response_tools.contextResponseInfo["..."]) ... """ from .version import __version__ -from response_tools_py.io.load_yaml import load_response_context +from response_tools.io.load_yaml import load_response_context # for global context info contextResponseInfo = load_response_context() diff --git a/response-tools-py/response_tools_py/attenuation.py b/response_tools/attenuation.py similarity index 99% rename from response-tools-py/response_tools_py/attenuation.py rename to response_tools/attenuation.py index 85b5c7c..076f259 100644 --- a/response-tools-py/response_tools_py/attenuation.py +++ b/response_tools/attenuation.py @@ -13,11 +13,11 @@ import pandas import scipy -from response_tools_py.util import BaseOutput, native_resolution +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-py-figs", "att-figs") +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 class AttOutput(BaseOutput): diff --git a/response-tools-py/response_tools_py/aux/README.md b/response_tools/aux/README.md similarity index 97% rename from response-tools-py/response_tools_py/aux/README.md rename to response_tools/aux/README.md index b4dc63b..15adf54 100644 --- a/response-tools-py/response_tools_py/aux/README.md +++ b/response_tools/aux/README.md @@ -1,4 +1,4 @@ -# `response_tools_py.aux` +# `response_tools.aux` A folder to contain any extra code/processes used for, say, formatting the files we have. Somewhere to document this stuff. diff --git a/response-tools-py/response_tools_py/aux/format-msfc-eff-areas.py b/response_tools/aux/format-msfc-eff-areas.py similarity index 100% rename from response-tools-py/response_tools_py/aux/format-msfc-eff-areas.py rename to response_tools/aux/format-msfc-eff-areas.py diff --git a/response-tools-py/response_tools_py/detector_response.py b/response_tools/detector_response.py similarity index 99% rename from response-tools-py/response_tools_py/detector_response.py rename to response_tools/detector_response.py index a76398d..60d7486 100644 --- a/response-tools-py/response_tools_py/detector_response.py +++ b/response_tools/detector_response.py @@ -11,10 +11,10 @@ import astropy.units as u import numpy as np -from response_tools_py.util import BaseOutput +from response_tools.util import BaseOutput -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-py-figs", "det-resp-figs") +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 class DetectorResponseOutput(BaseOutput): diff --git a/response-tools-py/response_tools_py/effective_area.py b/response_tools/effective_area.py similarity index 99% rename from response-tools-py/response_tools_py/effective_area.py rename to response_tools/effective_area.py index c33c48f..d9cd4b2 100644 --- a/response-tools-py/response_tools_py/effective_area.py +++ b/response_tools/effective_area.py @@ -14,10 +14,10 @@ from scipy.interpolate import CloughTocher2DInterpolator import pandas -from response_tools_py.util import BaseOutput, native_resolution +from response_tools.util import BaseOutput, native_resolution -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-py-figs", "eff-area-figs") +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 class EffAreaOutput(BaseOutput): diff --git a/response-tools-py/response_tools_py/io/__init__.py b/response_tools/io/__init__.py similarity index 100% rename from response-tools-py/response_tools_py/io/__init__.py rename to response_tools/io/__init__.py diff --git a/response-tools-py/response_tools_py/io/load_yaml.py b/response_tools/io/load_yaml.py similarity index 89% rename from response-tools-py/response_tools_py/io/load_yaml.py rename to response_tools/io/load_yaml.py index eda0c4c..2bda7ad 100644 --- a/response-tools-py/response_tools_py/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-py/response_tools_py/io/tests/README.md b/response_tools/io/tests/README.md similarity index 56% rename from response-tools-py/response_tools_py/io/tests/README.md rename to response_tools/io/tests/README.md index f5f1f48..5a36b57 100644 --- a/response-tools-py/response_tools_py/io/tests/README.md +++ b/response_tools/io/tests/README.md @@ -1,3 +1,3 @@ -# `response-tools-py.io` Tests +# `response-tools.io` Tests Please put Python test scripts in here. diff --git a/response-tools-py/response_tools_py/io/tests/__init__.py b/response_tools/io/tests/__init__.py similarity index 100% rename from response-tools-py/response_tools_py/io/tests/__init__.py rename to response_tools/io/tests/__init__.py diff --git a/response-tools-py/response_tools_py/ir-plots.py b/response_tools/ir-plots.py similarity index 99% rename from response-tools-py/response_tools_py/ir-plots.py rename to response_tools/ir-plots.py index 54d7ee1..40ede16 100644 --- a/response-tools-py/response_tools_py/ir-plots.py +++ b/response_tools/ir-plots.py @@ -26,7 +26,7 @@ def foxsi4_response_paths(save_assets=False): - assets_dir = os.path.join(pathlib.Path(__file__).parent, "..", "..", "assets", "response-tools-py-figs", "response-paths") + assets_dir = os.path.join(pathlib.Path(__file__).parent, "..", "..", "assets", "response-tools-figs", "response-paths") pathlib.Path(assets_dir).mkdir(parents=True, exist_ok=True) plt.rcParams.update({'font.size': 7}) diff --git a/response-tools-py/response_tools_py/phot_spec.py b/response_tools/phot_spec.py similarity index 100% rename from response-tools-py/response_tools_py/phot_spec.py rename to response_tools/phot_spec.py diff --git a/response-tools-py/response_tools_py/quantum_efficiency.py b/response_tools/quantum_efficiency.py similarity index 94% rename from response-tools-py/response_tools_py/quantum_efficiency.py rename to response_tools/quantum_efficiency.py index 819cbc6..7ec72b7 100644 --- a/response-tools-py/response_tools_py/quantum_efficiency.py +++ b/response_tools/quantum_efficiency.py @@ -10,10 +10,10 @@ import astropy.units as u import numpy as np -from response_tools_py.util import BaseOutput, native_resolution +from response_tools.util import BaseOutput, native_resolution -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-py-figs", "quantum-eff-figs") +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 class QuantumEffOutput(BaseOutput): diff --git a/response-tools-py/response_tools_py/responses.py b/response_tools/responses.py similarity index 99% rename from response-tools-py/response_tools_py/responses.py rename to response_tools/responses.py index 435f380..28188f9 100644 --- a/response-tools-py/response_tools_py/responses.py +++ b/response_tools/responses.py @@ -9,11 +9,11 @@ import astropy.units as u import numpy as np -from response_tools_py.attenuation import att_foxsi4_atmosphere -import response_tools_py.telescope_parts as tp -from response_tools_py.util import BaseOutput +from response_tools.attenuation import att_foxsi4_atmosphere +import response_tools.telescope_parts as tp +from response_tools.util import BaseOutput -ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "..", "assets", "response-tools-py-figs", "response-figs") +ASSETS_PATH = os.path.join(pathlib.Path(__file__).parent, "..", "assets", "response-tools-figs", "response-figs") @dataclass class Response1DOutput(BaseOutput): diff --git a/response-tools-py/response_tools_py/telescope_parts.py b/response_tools/telescope_parts.py similarity index 97% rename from response-tools-py/response_tools_py/telescope_parts.py rename to response_tools/telescope_parts.py index fb17526..f7513e0 100644 --- a/response-tools-py/response_tools_py/telescope_parts.py +++ b/response_tools/telescope_parts.py @@ -5,18 +5,18 @@ import astropy.units as u -from response_tools_py.attenuation import (att_thermal_blanket, - att_pixelated, - att_al_mylar, - att_uniform_al_cdte - ) -from response_tools_py.detector_response import (cdte_det_resp, - cmos_det_resp, - ) -from response_tools_py.effective_area import (eff_area_msfc_10shell, - eff_area_msfc_hi_res, - eff_area_nagoya_hxt, +from response_tools.attenuation import (att_thermal_blanket, + att_pixelated, + att_al_mylar, + att_uniform_al_cdte + ) +from response_tools.detector_response import (cdte_det_resp, + cmos_det_resp, ) +from response_tools.effective_area import (eff_area_msfc_10shell, + eff_area_msfc_hi_res, + eff_area_nagoya_hxt, + ) # position 2 @u.quantity_input(mid_energies=u.keV) diff --git a/response-tools-py/response_tools_py/util.py b/response_tools/util.py similarity index 100% rename from response-tools-py/response_tools_py/util.py rename to response_tools/util.py diff --git a/response_tools/version.py b/response_tools/version.py new file mode 100644 index 0000000..ee5165f --- /dev/null +++ b/response_tools/version.py @@ -0,0 +1,3 @@ +import importlib.metadata + +__version__ = importlib.metadata.version("response_tools") diff --git a/response-tools-py/setup.py b/setup.py similarity index 93% rename from response-tools-py/setup.py rename to setup.py index eaabd7f..7c8254c 100644 --- a/response-tools-py/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import setuptools setuptools.setup( - name="response_tools_py", + name="response_tools", version="0.0.1", description="Software used for the FOXSI response files.", url="https://github.com/foxsi/response-tools", diff --git a/tests/README.md b/tests/README.md index 87d6817..28d2a44 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,3 +1,3 @@ # `response-tools` -Please put tests spanning multiple languages in here. +Please put Python tests in here.