From 13b329d4e7965918c8583996a2f68edb8f150933 Mon Sep 17 00:00:00 2001 From: paolomassa Date: Mon, 29 Apr 2024 14:10:34 +0100 Subject: [PATCH 1/7] Cleanup of visibility (u,v) points definition - Merged 'get_visibility_info_giordano' and 'get_visibility_info' into 'get_uv_points_data' - Removed 'correct_phase_projection' since it is not needed with the new definition of (u,v) points - Added 'test_visibility.py' (and removed 'test_visibility.bk') - Updated 'imaging_demo.py' to be consistent with the new definition of (u,v) points --- examples/imaging_demo.py | 15 +- stixpy/calibration/tests/test_visibility.bk | 6 - stixpy/calibration/tests/test_visibility.py | 6 + stixpy/calibration/visibility.py | 149 ++++---------------- 4 files changed, 42 insertions(+), 134 deletions(-) delete mode 100644 stixpy/calibration/tests/test_visibility.bk create mode 100644 stixpy/calibration/tests/test_visibility.py diff --git a/examples/imaging_demo.py b/examples/imaging_demo.py index bad5a03..04b0fed 100644 --- a/examples/imaging_demo.py +++ b/examples/imaging_demo.py @@ -25,7 +25,7 @@ calibrate_visibility, create_meta_pixels, create_visibility, - get_visibility_info_giordano, + get_uv_points_data, ) from stixpy.product import Product @@ -67,9 +67,9 @@ # Calibrate the visibilties # Extra phase calihraiton not needed with these -uu, vv = get_visibility_info_giordano() -vis.u = uu -vis.v = vv +uv_data = get_uv_points_data() +vis.u = uv_data['u'] +vis.v = uv_data['v'] cal_vis = calibrate_visibility(vis) @@ -127,9 +127,9 @@ ) vis = create_visibility(meta_pixels) -uu, vv = get_visibility_info_giordano() -vis.u = uu -vis.v = vv +uv_data = get_uv_points_data() +vis.u = uv_data['u'] +vis.v = uv_data['v'] cal_vis = calibrate_visibility(vis, [max_hpc.Tx, max_hpc.Ty]) ############################################################################### @@ -233,6 +233,7 @@ axes[1, 1].set_title("EM") fig.colorbar(d) fig.tight_layout() +plt.show() # roll, pos, ref = get_hpc_info(Time(time_range[0])) # solo_coord = SkyCoord(*pos, frame='heliocentricearthecliptic', representation_type='cartesian', obstime=Time(time_range[0])) diff --git a/stixpy/calibration/tests/test_visibility.bk b/stixpy/calibration/tests/test_visibility.bk deleted file mode 100644 index 7c12447..0000000 --- a/stixpy/calibration/tests/test_visibility.bk +++ /dev/null @@ -1,6 +0,0 @@ -from stixcore.calibration.visibility import get_visibility_info_giordano - - -def test_get_visibility_info_giordano(): - vis = get_visibility_info_giordano() - assert True diff --git a/stixpy/calibration/tests/test_visibility.py b/stixpy/calibration/tests/test_visibility.py new file mode 100644 index 0000000..4e0d57f --- /dev/null +++ b/stixpy/calibration/tests/test_visibility.py @@ -0,0 +1,6 @@ +from stixpy.calibration.visibility import get_uv_points_data + + +def test_get_uv_points_data(): + uv_data = get_uv_points_data() + assert True diff --git a/stixpy/calibration/visibility.py b/stixpy/calibration/visibility.py index aac9de3..ec9654b 100644 --- a/stixpy/calibration/visibility.py +++ b/stixpy/calibration/visibility.py @@ -233,7 +233,7 @@ def create_visibility(meta_pixels): real_err = np.sqrt(abcd_rate_error_kev_cm[:, 2] ** 2 + abcd_rate_error_kev_cm[:, 0] ** 2).value * real.unit imag_err = np.sqrt(abcd_rate_error_kev_cm[:, 3] ** 2 + abcd_rate_error_kev_cm[:, 1] ** 2).value * real.unit - vis = get_visibility_info() + vis = get_uv_points_data() # Compute raw phases phase = np.arctan2(imag, real) @@ -263,39 +263,35 @@ def create_visibility(meta_pixels): return vis -def get_visibility_info(grid_separation=550 * u.mm): +def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): r""" - Return the sub-collimator data and corresponding u, v points. + Returns the STIX (u,v) points coordinates defined in [1]. The coordinates are ordered with respect to the detector index. Parameters ---------- - grid_separation : `float`, optional - Front to read grid separation - + d_det: astropy Quantity + Distance between the rear grid and the detector plane (in mm). Default, 47.78 * u.mm + + d_sep: astropy Quantity + Distance between the front and the rear grid (in mm). Default, 545.30 * u.mm + Returns ------- + A dictionary containing sub-collimator indices, sub-collimator labels and coordinates of the STIX (u,v) points (defined in arcsec^-1) + + References + ---------- + [1] Massa et al., 2023, The STIX Imaging Concept, Solar Physics, 298, + https://doi.org/10.1007/s11207-023-02205-7 """ - # imaging sub-collimators + subc = read_subc_params() imaging_ind = np.where((subc["Grid Label"] != "cfl") & (subc["Grid Label"] != "bkg")) # filter out background monitor and flare locator subc_imaging = subc[imaging_ind] - # take average of front and rear grid pitches (mm) - pitch = (subc_imaging["Front Pitch"] + subc_imaging["Rear Pitch"]) / 2.0 - - # convert pitch from mm to arcsec - # TODO check diff not using small angle approx - pitch = (pitch / grid_separation).decompose() * u.rad - - # take average of front and rear grid orientation - orientation = (subc_imaging["Front Orient"] + subc_imaging["Rear Orient"]) / 2.0 - - # calculate number of frequency components - len(subc_imaging) - # assign detector numbers to visibility index of subcollimator (isc) isc = subc_imaging["Det #"] @@ -305,62 +301,9 @@ def get_visibility_info(grid_separation=550 * u.mm): # save phase orientation of the grids to the visibility phase_sense = subc_imaging["Phase Sense"] - # calculate u and v - uv = 1.0 / pitch.to("arcsec") - uu = uv * np.cos(orientation.to("rad")) - vv = uv * np.sin(orientation.to("rad")) - - # Add the lifetime isc association. This gives the lifetime pairings - # vis.live_time = stx_ltpair_assignment(vis.isc) - - vis = { - "pitch": pitch, - "orientation": orientation, - "isc": isc, - "label": label, - "phase_sense": phase_sense, - "u": uu, - "v": vv, - } - return vis - - -def get_visibility_info_giordano(): - L1 = 545.30 * u.mm - L2 = 47.78 * u.mm - - subc = read_subc_params() - imaging_ind = np.where((subc["Grid Label"] != "cfl") & (subc["Grid Label"] != "bkg")) - - # np.where((subc['Grid Label'] != 'cfl') & (subc['Grid Label'] != 'bkg')) - - # filter out background monitor and flare locator - subc_imaging = subc[imaging_ind] - - # take average of front and rear grid pitches (mm) - # pitch = (subc_imaging['Front Pitch'] + subc_imaging['Rear Pitch']) / 2.0 - - # convert pitch from mm to arcsec - # TODO check diff not using small angle approx - # pitch = (pitch / L1).decompose() * u.rad - - # take average of front and rear grid orientation - # (subc_imaging['Front Orient'] + subc_imaging['Rear Orient']) / 2.0 - - # calculate number of frequency components - # len(subc_imaging) - - # assign detector numbers to visibility index of subcollimator (isc) - # isc = subc_imaging['Det #'] - - # assign the stix sc label for convenience - subc_imaging["Grid Label"] - - # save phase orientation of the grids to the visibility - phase_sense = subc_imaging["Phase Sense"] - - pitch_front = (1 / subc_imaging["Front Pitch"] * (L2 + L1)).value * 1 / u.rad - pitch_rear = (1 / subc_imaging["Rear Pitch"] * L2).value * 1 / u.rad + # see Equation (9) in [1] + pitch_front = (1 / subc_imaging["Front Pitch"] * (d_det + d_sep)).value * 1 / u.rad + pitch_rear = (1 / subc_imaging["Rear Pitch"] * d_det).value * 1 / u.rad uu = np.cos(subc_imaging["Front Orient"].to("deg")) * pitch_front.to(1 / u.arcsec) - np.cos( subc_imaging["Rear Orient"].to("deg") @@ -372,8 +315,15 @@ def get_visibility_info_giordano(): uu = -uu * phase_sense vv = -vv * phase_sense - return uu.to(1 / u.arcsec), vv.to(1 / u.arcsec) + uv_data = { + "isc": isc, # sub-collimator indices + "label": label, # sub-collimator labels + "u": uu.to(1 / u.arcsec), + "v": vv.to(1 / u.arcsec), + } + return uv_data + def calibrate_visibility(vis, flare_location=(0, 0) * u.arcsec): """ @@ -436,50 +386,7 @@ def calibrate_visibility(vis, flare_location=(0, 0) * u.arcsec): ) return cal_vis - - -def correct_phase_projection(vis, flare_xy): - r""" - Correct visibilities for projection of the grids onto the detectors. - - The rear grids are not in direct contact with the detectors so the phase of the visibilities - needs to be project onto the grid and this is dependent on the position of the xray emission - - Parameters - ---------- - vis - Input visibilities - flare_xy - Position of the flare - - Returns - ------- - - """ - # Phase projection correction - l1 = 550 * u.mm # separation of front rear grid - l2 = 47 * u.mm # separation of rear grid and detector - # TODO check how this works out to degrees - vis.phase -= ( - flare_xy[1].to_value("arcsec") * 360.0 * np.pi / (180.0 * 3600.0 * 8.8 * u.mm) * (l2 + l1 / 2.0) - ) * u.deg - - vis.u *= -vis.phase_sense - vis.v *= -vis.phase_sense - - # Compute real and imaginary part of the visibility - vis.obsvis = vis.amplitude * (np.cos(vis.phase.to("rad")) + np.sin(vis.phase.to("rad")) * 1j) - - # Add phase factor for shifting the flare_xy - map_center = flare_xy # - [26.1, 58.2] * u.arcsec - # Subtract Frederic's mean shift values - - # TODO check the u, v why is flare_xy[1] used with u (prob stix vs spacecraft orientation - phase_mapcenter = -2 * np.pi * (map_center[0] * vis.u - map_center[1] * vis.v) * u.rad - vis.obsvis *= np.cos(phase_mapcenter) + np.sin(phase_mapcenter) * 1j - - return vis - + def sas_map_center(): # receter map at 0,0 taking account of mean or actual sas sol From f931791620cfaa56479c3e5e54df490aa637eb7b Mon Sep 17 00:00:00 2001 From: paolomassa Date: Mon, 29 Apr 2024 15:03:49 +0100 Subject: [PATCH 2/7] Fixed test --- .pre-commit-config.yaml | 2 +- examples/imaging_demo.py | 21 ++++++++++++--------- stixpy/calibration/tests/test_visibility.py | 7 ++++++- stixpy/calibration/visibility.py | 10 +++++----- stixpy/tests/test_science.py | 7 +------ 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62c0d80..c7ba232 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: rev: 5.13.2 hooks: - id: isort - exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|)$" + exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*)$" - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: diff --git a/examples/imaging_demo.py b/examples/imaging_demo.py index 04b0fed..444439c 100644 --- a/examples/imaging_demo.py +++ b/examples/imaging_demo.py @@ -12,27 +12,30 @@ """ import logging + import astropy.units as u import matplotlib.pyplot as plt import numpy as np -# from astropy.coordinates import SkyCoord -# from astropy.time import Time -# from sunpy.map import make_fitswcs_header, Map +from xrayvision.clean import vis_clean +from xrayvision.imaging import vis_to_image, vis_to_map +from xrayvision.mem import mem +from xrayvision.visibility import Visibility -# from stixpy.frames import get_hpc_info -from stixpy.imaging.em import em from stixpy.calibration.visibility import ( calibrate_visibility, create_meta_pixels, create_visibility, get_uv_points_data, ) +# from stixpy.frames import get_hpc_info +from stixpy.imaging.em import em from stixpy.product import Product -from xrayvision.clean import vis_clean -from xrayvision.imaging import vis_to_image, vis_to_map -from xrayvision.mem import mem -from xrayvision.visibility import Visibility +# from astropy.coordinates import SkyCoord +# from astropy.time import Time +# from sunpy.map import make_fitswcs_header, Map + + logger = logging.getLogger(__name__) logger.setLevel("DEBUG") diff --git a/stixpy/calibration/tests/test_visibility.py b/stixpy/calibration/tests/test_visibility.py index 4e0d57f..e0b8d11 100644 --- a/stixpy/calibration/tests/test_visibility.py +++ b/stixpy/calibration/tests/test_visibility.py @@ -1,6 +1,11 @@ +import astropy.units as u + from stixpy.calibration.visibility import get_uv_points_data def test_get_uv_points_data(): uv_data = get_uv_points_data() - assert True + assert uv_data['u'][0] == -0.03333102271709666 / u.arcsec + assert uv_data['v'][0] == 0.005908224739704219 / u.arcsec + assert uv_data['isc'][0] == 1 + assert uv_data['label'][0] == '3c' diff --git a/stixpy/calibration/visibility.py b/stixpy/calibration/visibility.py index ec9654b..745b78c 100644 --- a/stixpy/calibration/visibility.py +++ b/stixpy/calibration/visibility.py @@ -271,10 +271,10 @@ def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): ---------- d_det: astropy Quantity Distance between the rear grid and the detector plane (in mm). Default, 47.78 * u.mm - + d_sep: astropy Quantity Distance between the front and the rear grid (in mm). Default, 545.30 * u.mm - + Returns ------- A dictionary containing sub-collimator indices, sub-collimator labels and coordinates of the STIX (u,v) points (defined in arcsec^-1) @@ -285,7 +285,7 @@ def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): https://doi.org/10.1007/s11207-023-02205-7 """ - + subc = read_subc_params() imaging_ind = np.where((subc["Grid Label"] != "cfl") & (subc["Grid Label"] != "bkg")) @@ -323,7 +323,7 @@ def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): } return uv_data - + def calibrate_visibility(vis, flare_location=(0, 0) * u.arcsec): """ @@ -386,7 +386,7 @@ def calibrate_visibility(vis, flare_location=(0, 0) * u.arcsec): ) return cal_vis - + def sas_map_center(): # receter map at 0,0 taking account of mean or actual sas sol diff --git a/stixpy/tests/test_science.py b/stixpy/tests/test_science.py index 916340e..cf7a95b 100644 --- a/stixpy/tests/test_science.py +++ b/stixpy/tests/test_science.py @@ -4,12 +4,7 @@ from numpy.testing import assert_allclose from stixpy.product import Product -from stixpy.product.sources.science import ( - CompressedPixelData, - RawPixelData, - Spectrogram, - SummedCompressedPixelData, -) +from stixpy.product.sources.science import CompressedPixelData, RawPixelData, Spectrogram, SummedCompressedPixelData @pytest.mark.remote_data From 9c5bbdb5697b7c704b8637df5c022a785693e2d5 Mon Sep 17 00:00:00 2001 From: paolomassa Date: Mon, 29 Apr 2024 15:22:33 +0100 Subject: [PATCH 3/7] Updated changelog and documentation --- changelog/98.feature.rst | 1 + docs/reference/calibration.rst | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 changelog/98.feature.rst create mode 100644 docs/reference/calibration.rst diff --git a/changelog/98.feature.rst b/changelog/98.feature.rst new file mode 100644 index 0000000..b89eb23 --- /dev/null +++ b/changelog/98.feature.rst @@ -0,0 +1 @@ +Merged `stixpy.calibration.get_visibility_info_giordano` and `stixpy.calibration.get_visibility_info` into `stixpy.calibration.get_uv_points_data` and removed `stixpy.calibration.correct_phase_projection`. diff --git a/docs/reference/calibration.rst b/docs/reference/calibration.rst new file mode 100644 index 0000000..e941dbc --- /dev/null +++ b/docs/reference/calibration.rst @@ -0,0 +1,22 @@ +.. _ calibration: + +Calibration ('stixpy.calibration') +************************************** + +The ``calibration`` submodule contains functions for calibrating STIX data. + +.. automodapi:: stixpy.calibration + +.. automodapi:: stixpy.calibration.compression + +.. automodapi:: stixpy.calibration.detector + +.. automodapi:: stixpy.calibration.energy + +.. automodapi:: stixpy.calibration.grid + +.. automodapi:: stixpy.calibration.livetime + +.. automodapi:: stixpy.calibration.transmission + +.. automodapi:: stixpy.calibration.visibility From e14eb3f63454cf6882334ae62422fb1f3a7e939c Mon Sep 17 00:00:00 2001 From: paolomassa Date: Mon, 29 Apr 2024 15:32:00 +0100 Subject: [PATCH 4/7] Update livetime.py --- stixpy/calibration/livetime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stixpy/calibration/livetime.py b/stixpy/calibration/livetime.py index 348b178..2f3c614 100644 --- a/stixpy/calibration/livetime.py +++ b/stixpy/calibration/livetime.py @@ -29,7 +29,7 @@ from matplotlib import pyplot as plt - from stixcore.calibration.lifetime import get_livetime_fraction + from stixpy.calibration.livetime import get_livetime_fraction eta = 2.5e-6 tau = 12.5e-6 From e8759a2b25c62ef337fed7b4a7e50406c4c51a5e Mon Sep 17 00:00:00 2001 From: paolomassa Date: Mon, 29 Apr 2024 16:39:47 +0100 Subject: [PATCH 5/7] Add calibration to doc --- docs/reference/index.rst | 1 + stixpy/calibration/detector.py | 2 ++ stixpy/calibration/energy.py | 1 + stixpy/calibration/grid.py | 1 + stixpy/calibration/visibility.py | 6 ++++++ 5 files changed, 11 insertions(+) diff --git a/docs/reference/index.rst b/docs/reference/index.rst index f010bbd..3007e01 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -8,6 +8,7 @@ Reference :maxdepth: 2 data + calibration timeseries science product diff --git a/stixpy/calibration/detector.py b/stixpy/calibration/detector.py index 233e5b6..1fa0395 100644 --- a/stixpy/calibration/detector.py +++ b/stixpy/calibration/detector.py @@ -8,6 +8,8 @@ from stixpy.calibration.transmission import Transmission from stixpy.io.readers import read_energy_channel_index, read_sci_energy_channels +__all__ = ['get_srm','get_pixel_srm','get_sci_channels'] + SCI_INDEX = None SCI_CHANNELS = {} diff --git a/stixpy/calibration/energy.py b/stixpy/calibration/energy.py index 19c4a9b..6faa30f 100644 --- a/stixpy/calibration/energy.py +++ b/stixpy/calibration/energy.py @@ -6,6 +6,7 @@ from stixpy.product import Product from stixpy.utils.rebining import rebin_proportional +__all__ = ['get_elut','correct_counts'] def get_elut(date): root = Path(__file__).parent.parent diff --git a/stixpy/calibration/grid.py b/stixpy/calibration/grid.py index 6df15e0..4ddb8db 100644 --- a/stixpy/calibration/grid.py +++ b/stixpy/calibration/grid.py @@ -8,6 +8,7 @@ import numpy as np from astropy.table import Table +__all__ = ["get_grid_transmission","_calculate_grid_transmission"] def get_grid_transmission(xy_flare): r""" diff --git a/stixpy/calibration/visibility.py b/stixpy/calibration/visibility.py index 745b78c..87f43a6 100644 --- a/stixpy/calibration/visibility.py +++ b/stixpy/calibration/visibility.py @@ -11,6 +11,12 @@ from stixpy.calibration.livetime import get_livetime_fraction from stixpy.io.readers import read_subc_params +__all__ = ["get_subcollimator_info", + "create_meta_pixels", + "create_visibility", + "get_uv_points_data", + "calibrate_visibility", + "sas_map_center"] def get_subcollimator_info(): r""" From 9fa61685f5c1d62199f6135f8cc4778585776ea5 Mon Sep 17 00:00:00 2001 From: paolomassa Date: Mon, 29 Apr 2024 17:07:41 +0100 Subject: [PATCH 6/7] Cleanup of (u,v) points coordinate definition --- stixpy/calibration/visibility.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/stixpy/calibration/visibility.py b/stixpy/calibration/visibility.py index 87f43a6..4463fde 100644 --- a/stixpy/calibration/visibility.py +++ b/stixpy/calibration/visibility.py @@ -275,15 +275,15 @@ def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): Parameters ---------- - d_det: astropy Quantity + d_det: `u.Quantity` optional Distance between the rear grid and the detector plane (in mm). Default, 47.78 * u.mm - d_sep: astropy Quantity + d_sep: `u.Quantity` optional Distance between the front and the rear grid (in mm). Default, 545.30 * u.mm Returns ------- - A dictionary containing sub-collimator indices, sub-collimator labels and coordinates of the STIX (u,v) points (defined in arcsec^-1) + A dictionary containing sub-collimator indices, sub-collimator labels and coordinates of the STIX (u,v) points (defined in arcsec$^{-1}$) References ---------- @@ -308,15 +308,13 @@ def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): phase_sense = subc_imaging["Phase Sense"] # see Equation (9) in [1] - pitch_front = (1 / subc_imaging["Front Pitch"] * (d_det + d_sep)).value * 1 / u.rad - pitch_rear = (1 / subc_imaging["Rear Pitch"] * d_det).value * 1 / u.rad + front_unit_vector_comp = (((d_det + d_sep) / subc_imaging["Front Pitch"]) / u.rad).to(1 / u.arcsec) + rear_unit_vector_comp = ((d_det / subc_imaging["Rear Pitch"]) / u.rad).to(1 / u.arcsec) - uu = np.cos(subc_imaging["Front Orient"].to("deg")) * pitch_front.to(1 / u.arcsec) - np.cos( - subc_imaging["Rear Orient"].to("deg") - ) * pitch_rear.to(1 / u.arcsec) - vv = np.sin(subc_imaging["Front Orient"].to("deg")) * pitch_front.to(1 / u.arcsec) - np.sin( - subc_imaging["Rear Orient"].to("deg") - ) * pitch_rear.to(1 / u.arcsec) + uu = np.cos(subc_imaging["Front Orient"].to("deg")) * front_unit_vector_comp - np.cos( + subc_imaging["Rear Orient"].to("deg")) * rear_unit_vector_comp + vv = np.sin(subc_imaging["Front Orient"].to("deg")) * front_unit_vector_comp - np.sin( + subc_imaging["Rear Orient"].to("deg")) * rear_unit_vector_comp uu = -uu * phase_sense vv = -vv * phase_sense @@ -324,8 +322,8 @@ def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): uv_data = { "isc": isc, # sub-collimator indices "label": label, # sub-collimator labels - "u": uu.to(1 / u.arcsec), - "v": vv.to(1 / u.arcsec), + "u": uu, + "v": vv, } return uv_data From da2b611f6661bf516117d1a470f589f72f0aa7c9 Mon Sep 17 00:00:00 2001 From: paolomassa Date: Tue, 30 Apr 2024 10:20:51 +0100 Subject: [PATCH 7/7] Update visibility.py Add check for units of 'd_sep' and 'd_det' in 'get_uv_points_data' --- stixpy/calibration/visibility.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stixpy/calibration/visibility.py b/stixpy/calibration/visibility.py index 4463fde..e552537 100644 --- a/stixpy/calibration/visibility.py +++ b/stixpy/calibration/visibility.py @@ -269,21 +269,22 @@ def create_visibility(meta_pixels): return vis -def get_uv_points_data(d_det=47.78 * u.mm, d_sep=545.30 * u.mm): +@u.quantity_input +def get_uv_points_data(d_det: u.Quantity[u.mm]=47.78 * u.mm, d_sep:u.Quantity[u.mm]=545.30 * u.mm): r""" Returns the STIX (u,v) points coordinates defined in [1]. The coordinates are ordered with respect to the detector index. Parameters ---------- - d_det: `u.Quantity` optional + d_det: `u.Quantity[u.mm]` optional Distance between the rear grid and the detector plane (in mm). Default, 47.78 * u.mm - d_sep: `u.Quantity` optional + d_sep: `u.Quantity[u.mm]` optional Distance between the front and the rear grid (in mm). Default, 545.30 * u.mm Returns ------- - A dictionary containing sub-collimator indices, sub-collimator labels and coordinates of the STIX (u,v) points (defined in arcsec$^{-1}$) + A dictionary containing sub-collimator indices, sub-collimator labels and coordinates of the STIX (u,v) points (defined in arcsec :sup:`-1`) References ----------