imap-processing 0.7.0__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of imap-processing might be problematic. Click here for more details.
- imap_processing/__init__.py +1 -1
- imap_processing/_version.py +2 -2
- imap_processing/ccsds/excel_to_xtce.py +34 -2
- imap_processing/cdf/config/imap_codice_global_cdf_attrs.yaml +1 -1
- imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml +145 -30
- imap_processing/cdf/config/imap_glows_l1b_variable_attrs.yaml +36 -36
- imap_processing/cdf/config/imap_hi_variable_attrs.yaml +36 -8
- imap_processing/cdf/config/imap_hit_l1b_variable_attrs.yaml +9 -0
- imap_processing/cdf/config/imap_idex_global_cdf_attrs.yaml +7 -7
- imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +32 -33
- imap_processing/cdf/config/imap_mag_l1_variable_attrs.yaml +24 -28
- imap_processing/cdf/config/imap_ultra_l1a_variable_attrs.yaml +1 -0
- imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml +133 -78
- imap_processing/cdf/config/imap_variable_schema.yaml +13 -0
- imap_processing/cdf/imap_cdf_manager.py +31 -27
- imap_processing/cli.py +12 -10
- imap_processing/codice/codice_l1a.py +151 -61
- imap_processing/codice/constants.py +1 -1
- imap_processing/codice/decompress.py +4 -9
- imap_processing/codice/utils.py +1 -0
- imap_processing/glows/l1b/glows_l1b.py +3 -3
- imap_processing/glows/l1b/glows_l1b_data.py +59 -37
- imap_processing/glows/l2/glows_l2_data.py +123 -0
- imap_processing/hi/l1a/histogram.py +1 -1
- imap_processing/hi/l1a/science_direct_event.py +1 -1
- imap_processing/hi/l1b/hi_l1b.py +85 -11
- imap_processing/hi/l1c/hi_l1c.py +23 -1
- imap_processing/hi/utils.py +1 -1
- imap_processing/hit/hit_utils.py +221 -0
- imap_processing/hit/l0/constants.py +118 -0
- imap_processing/hit/l0/decom_hit.py +186 -153
- imap_processing/hit/l1a/hit_l1a.py +20 -175
- imap_processing/hit/l1b/hit_l1b.py +33 -153
- imap_processing/idex/idex_l1a.py +10 -9
- imap_processing/lo/l0/decompression_tables/decompression_tables.py +1 -1
- imap_processing/lo/l0/lo_science.py +1 -1
- imap_processing/lo/packet_definitions/lo_xtce.xml +1 -3296
- imap_processing/mag/l0/decom_mag.py +4 -3
- imap_processing/mag/l1a/mag_l1a.py +11 -11
- imap_processing/mag/l1b/mag_l1b.py +89 -7
- imap_processing/spice/geometry.py +126 -4
- imap_processing/swapi/l1/swapi_l1.py +1 -1
- imap_processing/swapi/l2/swapi_l2.py +1 -1
- imap_processing/swe/l1b/swe_l1b_science.py +8 -8
- imap_processing/tests/ccsds/test_data/expected_output.xml +1 -0
- imap_processing/tests/ccsds/test_excel_to_xtce.py +4 -4
- imap_processing/tests/cdf/test_imap_cdf_manager.py +0 -10
- imap_processing/tests/codice/conftest.py +1 -17
- imap_processing/tests/codice/data/imap_codice_l0_raw_20241110_v001.pkts +0 -0
- imap_processing/tests/codice/test_codice_l0.py +8 -2
- imap_processing/tests/codice/test_codice_l1a.py +127 -107
- imap_processing/tests/codice/test_codice_l1b.py +1 -0
- imap_processing/tests/codice/test_decompress.py +7 -7
- imap_processing/tests/conftest.py +54 -15
- imap_processing/tests/glows/conftest.py +6 -0
- imap_processing/tests/glows/test_glows_l1b.py +9 -9
- imap_processing/tests/glows/test_glows_l1b_data.py +9 -9
- imap_processing/tests/glows/test_glows_l2_data.py +0 -0
- imap_processing/tests/hi/test_data/l1a/imap_hi_l1a_45sensor-de_20250415_v000.cdf +0 -0
- imap_processing/tests/hi/test_hi_l1b.py +71 -1
- imap_processing/tests/hi/test_hi_l1c.py +10 -2
- imap_processing/tests/hi/test_utils.py +4 -3
- imap_processing/tests/hit/{test_hit_decom.py → test_decom_hit.py} +84 -35
- imap_processing/tests/hit/test_hit_l1a.py +2 -197
- imap_processing/tests/hit/test_hit_l1b.py +156 -25
- imap_processing/tests/hit/test_hit_utils.py +218 -0
- imap_processing/tests/idex/conftest.py +1 -1
- imap_processing/tests/idex/imap_idex_l0_raw_20231214_v001.pkts +0 -0
- imap_processing/tests/idex/impact_14_tof_high_data.txt +4444 -4444
- imap_processing/tests/idex/test_idex_l0.py +3 -3
- imap_processing/tests/idex/test_idex_l1a.py +1 -1
- imap_processing/tests/lo/test_lo_science.py +2 -2
- imap_processing/tests/mag/imap_mag_l1a_norm-magi_20251017_v001.cdf +0 -0
- imap_processing/tests/mag/test_mag_l1b.py +59 -3
- imap_processing/tests/spice/test_data/imap_ena_sim_metakernel.template +3 -1
- imap_processing/tests/spice/test_geometry.py +84 -4
- imap_processing/tests/swe/conftest.py +33 -0
- imap_processing/tests/swe/l1_validation/swe_l0_unpacked-data_20240510_v001_VALIDATION_L1B_v3.dat +4332 -0
- imap_processing/tests/swe/test_swe_l1b.py +29 -8
- imap_processing/tests/test_utils.py +1 -1
- imap_processing/tests/ultra/test_data/l1/dps_exposure_helio_45_E12.cdf +0 -0
- imap_processing/tests/ultra/test_data/l1/dps_exposure_helio_45_E24.cdf +0 -0
- imap_processing/tests/ultra/unit/test_de.py +108 -0
- imap_processing/tests/ultra/unit/test_ultra_l1b.py +27 -3
- imap_processing/tests/ultra/unit/test_ultra_l1b_annotated.py +31 -10
- imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py +21 -11
- imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py +9 -44
- imap_processing/ultra/constants.py +8 -3
- imap_processing/ultra/l1b/de.py +174 -30
- imap_processing/ultra/l1b/ultra_l1b_annotated.py +24 -10
- imap_processing/ultra/l1b/ultra_l1b_extended.py +21 -14
- imap_processing/ultra/l1c/ultra_l1c_pset_bins.py +70 -119
- {imap_processing-0.7.0.dist-info → imap_processing-0.8.0.dist-info}/METADATA +15 -14
- {imap_processing-0.7.0.dist-info → imap_processing-0.8.0.dist-info}/RECORD +98 -113
- imap_processing/cdf/cdf_attribute_manager.py +0 -322
- imap_processing/cdf/config/shared/default_global_cdf_attrs_schema.yaml +0 -246
- imap_processing/cdf/config/shared/default_variable_cdf_attrs_schema.yaml +0 -466
- imap_processing/hit/l0/data_classes/housekeeping.py +0 -240
- imap_processing/hit/l0/data_classes/science_packet.py +0 -259
- imap_processing/hit/l0/utils/hit_base.py +0 -57
- imap_processing/tests/cdf/shared/default_global_cdf_attrs_schema.yaml +0 -246
- imap_processing/tests/cdf/shared/default_variable_cdf_attrs_schema.yaml +0 -466
- imap_processing/tests/cdf/test_cdf_attribute_manager.py +0 -353
- imap_processing/tests/codice/data/imap_codice_l0_hi-counters-aggregated_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-counters-singles_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-omni_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-pha_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hi-sectored_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_hskp_20100101_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-counters-aggregated_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-counters-singles_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-angular_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-priority_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-nsw-species_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-pha_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-sw-angular_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-sw-priority_20240429_v001.pkts +0 -0
- imap_processing/tests/codice/data/imap_codice_l0_lo-sw-species_20240429_v001.pkts +0 -0
- imap_processing/tests/idex/imap_idex_l0_raw_20230725_v001.pkts +0 -0
- imap_processing/tests/mag/imap_mag_l1a_burst-magi_20231025_v001.cdf +0 -0
- /imap_processing/tests/hit/test_data/{imap_hit_l0_hk_20100105_v001.pkts → imap_hit_l0_raw_20100105_v001.pkts} +0 -0
- {imap_processing-0.7.0.dist-info → imap_processing-0.8.0.dist-info}/LICENSE +0 -0
- {imap_processing-0.7.0.dist-info → imap_processing-0.8.0.dist-info}/WHEEL +0 -0
- {imap_processing-0.7.0.dist-info → imap_processing-0.8.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,57 +1,65 @@
|
|
|
1
1
|
"""Module to create pointing sets."""
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
3
|
from pathlib import Path
|
|
5
4
|
|
|
6
5
|
import cdflib
|
|
7
6
|
import numpy as np
|
|
8
|
-
import spiceypy as spice
|
|
9
7
|
from numpy.typing import NDArray
|
|
10
8
|
|
|
11
|
-
from imap_processing.spice.
|
|
9
|
+
from imap_processing.spice.geometry import (
|
|
10
|
+
SpiceFrame,
|
|
11
|
+
cartesian_to_spherical,
|
|
12
|
+
imap_state,
|
|
13
|
+
spherical_to_cartesian,
|
|
14
|
+
)
|
|
12
15
|
from imap_processing.ultra.constants import UltraConstants
|
|
13
16
|
|
|
14
17
|
# TODO: add species binning.
|
|
15
18
|
|
|
16
19
|
|
|
17
|
-
def build_energy_bins() -> tuple[
|
|
20
|
+
def build_energy_bins() -> tuple[list[tuple[float, float]], np.ndarray]:
|
|
18
21
|
"""
|
|
19
22
|
Build energy bin boundaries.
|
|
20
23
|
|
|
21
24
|
Returns
|
|
22
25
|
-------
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
intervals : list[tuple[float, float]]
|
|
27
|
+
Energy bins.
|
|
25
28
|
energy_midpoints : np.ndarray
|
|
26
29
|
Array of energy bin midpoints.
|
|
27
30
|
"""
|
|
28
|
-
# TODO: these value will almost certainly change.
|
|
29
|
-
alpha = 0.2 # deltaE/E
|
|
30
|
-
energy_start = 3.385 # energy start for the Ultra grids
|
|
31
|
-
n_bins = 23 # number of energy bins
|
|
32
|
-
|
|
33
31
|
# Calculate energy step
|
|
34
|
-
energy_step = (1 +
|
|
32
|
+
energy_step = (1 + UltraConstants.ALPHA / 2) / (1 - UltraConstants.ALPHA / 2)
|
|
35
33
|
|
|
36
34
|
# Create energy bins.
|
|
37
|
-
energy_bin_edges =
|
|
35
|
+
energy_bin_edges = UltraConstants.ENERGY_START * energy_step ** np.arange(
|
|
36
|
+
UltraConstants.N_BINS + 1
|
|
37
|
+
)
|
|
38
38
|
# Add a zero to the left side for outliers and round to nearest 3 decimal places.
|
|
39
39
|
energy_bin_edges = np.around(np.insert(energy_bin_edges, 0, 0), 3)
|
|
40
40
|
energy_midpoints = (energy_bin_edges[:-1] + energy_bin_edges[1:]) / 2
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
intervals = [
|
|
43
|
+
(float(energy_bin_edges[i]), float(energy_bin_edges[i + 1]))
|
|
44
|
+
for i in range(len(energy_bin_edges) - 1)
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
return intervals, energy_midpoints
|
|
43
48
|
|
|
44
49
|
|
|
45
50
|
def build_spatial_bins(
|
|
46
|
-
|
|
51
|
+
az_spacing: float = 0.5,
|
|
52
|
+
el_spacing: float = 0.5,
|
|
47
53
|
) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
|
|
48
54
|
"""
|
|
49
55
|
Build spatial bin boundaries for azimuth and elevation.
|
|
50
56
|
|
|
51
57
|
Parameters
|
|
52
58
|
----------
|
|
53
|
-
|
|
54
|
-
The bin spacing in degrees (default is 0.5 degrees).
|
|
59
|
+
az_spacing : float, optional
|
|
60
|
+
The azimuth bin spacing in degrees (default is 0.5 degrees).
|
|
61
|
+
el_spacing : float, optional
|
|
62
|
+
The elevation bin spacing in degrees (default is 0.5 degrees).
|
|
55
63
|
|
|
56
64
|
Returns
|
|
57
65
|
-------
|
|
@@ -65,124 +73,71 @@ def build_spatial_bins(
|
|
|
65
73
|
Array of elevation bin midpoint values.
|
|
66
74
|
"""
|
|
67
75
|
# Azimuth bins from 0 to 360 degrees.
|
|
68
|
-
az_bin_edges = np.arange(0, 360 +
|
|
69
|
-
az_bin_midpoints = az_bin_edges[:-1] +
|
|
76
|
+
az_bin_edges = np.arange(0, 360 + az_spacing, az_spacing)
|
|
77
|
+
az_bin_midpoints = az_bin_edges[:-1] + az_spacing / 2 # Midpoints between edges
|
|
70
78
|
|
|
71
79
|
# Elevation bins from -90 to 90 degrees.
|
|
72
|
-
el_bin_edges = np.arange(-90, 90 +
|
|
73
|
-
el_bin_midpoints = el_bin_edges[:-1] +
|
|
80
|
+
el_bin_edges = np.arange(-90, 90 + el_spacing, el_spacing)
|
|
81
|
+
el_bin_midpoints = el_bin_edges[:-1] + el_spacing / 2 # Midpoints between edges
|
|
74
82
|
|
|
75
83
|
return az_bin_edges, el_bin_edges, az_bin_midpoints, el_bin_midpoints
|
|
76
84
|
|
|
77
85
|
|
|
78
|
-
def cartesian_to_spherical(
|
|
79
|
-
v: NDArray,
|
|
80
|
-
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
|
81
|
-
"""
|
|
82
|
-
Convert cartesian coordinates to spherical coordinates.
|
|
83
|
-
|
|
84
|
-
Parameters
|
|
85
|
-
----------
|
|
86
|
-
v : np.ndarray
|
|
87
|
-
A NumPy array with shape (n, 3) where each
|
|
88
|
-
row represents a vector
|
|
89
|
-
with x, y, z-components.
|
|
90
|
-
|
|
91
|
-
Returns
|
|
92
|
-
-------
|
|
93
|
-
az : np.ndarray
|
|
94
|
-
The azimuth angles in degrees.
|
|
95
|
-
el : np.ndarray
|
|
96
|
-
The elevation angles in degrees.
|
|
97
|
-
r : np.ndarray
|
|
98
|
-
The radii, or magnitudes, of the vectors.
|
|
99
|
-
"""
|
|
100
|
-
vx = v[:, 0]
|
|
101
|
-
vy = v[:, 1]
|
|
102
|
-
vz = v[:, 2]
|
|
103
|
-
|
|
104
|
-
# Magnitude of the velocity vector
|
|
105
|
-
magnitude_v = np.sqrt(vx**2 + vy**2 + vz**2)
|
|
106
|
-
|
|
107
|
-
vhat_x = -vx / magnitude_v
|
|
108
|
-
vhat_y = -vy / magnitude_v
|
|
109
|
-
vhat_z = -vz / magnitude_v
|
|
110
|
-
|
|
111
|
-
# Elevation angle (angle from the z-axis, range: [-pi/2, pi/2])
|
|
112
|
-
el = np.arcsin(vhat_z)
|
|
113
|
-
|
|
114
|
-
# Azimuth angle (angle in the xy-plane, range: [0, 2*pi])
|
|
115
|
-
az = np.arctan2(vhat_y, vhat_x)
|
|
116
|
-
|
|
117
|
-
# Ensure azimuth is from 0 to 2PI
|
|
118
|
-
az = az % (2 * np.pi)
|
|
119
|
-
|
|
120
|
-
return np.degrees(az), np.degrees(el), magnitude_v
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def spherical_to_cartesian(
|
|
124
|
-
r: np.ndarray, theta: np.ndarray, phi: np.ndarray
|
|
125
|
-
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
|
126
|
-
"""
|
|
127
|
-
Convert spherical coordinates to Cartesian coordinates.
|
|
128
|
-
|
|
129
|
-
Parameters
|
|
130
|
-
----------
|
|
131
|
-
r : np.ndarray
|
|
132
|
-
Radius.
|
|
133
|
-
theta : np.ndarray
|
|
134
|
-
Azimuth angle in radians.
|
|
135
|
-
phi : array-like or float
|
|
136
|
-
Elevation angle in radians.
|
|
137
|
-
|
|
138
|
-
Returns
|
|
139
|
-
-------
|
|
140
|
-
x, y, z : tuple
|
|
141
|
-
Cartesian coordinates.
|
|
142
|
-
"""
|
|
143
|
-
x = r * np.cos(phi) * np.cos(theta)
|
|
144
|
-
y = r * np.cos(phi) * np.sin(theta)
|
|
145
|
-
z = r * np.sin(phi)
|
|
146
|
-
|
|
147
|
-
return x, y, z
|
|
148
|
-
|
|
149
|
-
|
|
150
86
|
def get_histogram(
|
|
151
|
-
|
|
87
|
+
vhat: tuple[np.ndarray, np.ndarray, np.ndarray],
|
|
152
88
|
energy: np.ndarray,
|
|
153
89
|
az_bin_edges: np.ndarray,
|
|
154
90
|
el_bin_edges: np.ndarray,
|
|
155
|
-
energy_bin_edges:
|
|
91
|
+
energy_bin_edges: list[tuple[float, float]],
|
|
156
92
|
) -> NDArray:
|
|
157
93
|
"""
|
|
158
94
|
Compute a 3D histogram of the particle data.
|
|
159
95
|
|
|
160
96
|
Parameters
|
|
161
97
|
----------
|
|
162
|
-
|
|
163
|
-
The x,y,z-components of the velocity vector.
|
|
98
|
+
vhat : tuple[np.ndarray, np.ndarray, np.ndarray]
|
|
99
|
+
The x,y,z-components of the unit velocity vector.
|
|
164
100
|
energy : np.ndarray
|
|
165
101
|
The particle energy.
|
|
166
102
|
az_bin_edges : np.ndarray
|
|
167
103
|
Array of azimuth bin boundary values.
|
|
168
104
|
el_bin_edges : np.ndarray
|
|
169
105
|
Array of elevation bin boundary values.
|
|
170
|
-
energy_bin_edges :
|
|
106
|
+
energy_bin_edges : list[tuple[float, float]]
|
|
171
107
|
Array of energy bin edges.
|
|
172
108
|
|
|
173
109
|
Returns
|
|
174
110
|
-------
|
|
175
111
|
hist : np.ndarray
|
|
176
112
|
A 3D histogram array.
|
|
113
|
+
|
|
114
|
+
Notes
|
|
115
|
+
-----
|
|
116
|
+
The histogram will now work properly for overlapping energy bins, i.e.
|
|
117
|
+
the same energy value can fall into multiple bins if the intervals overlap.
|
|
177
118
|
"""
|
|
178
|
-
|
|
119
|
+
spherical_coords = cartesian_to_spherical(vhat)
|
|
120
|
+
az, el = (
|
|
121
|
+
spherical_coords[..., 1],
|
|
122
|
+
spherical_coords[..., 2],
|
|
123
|
+
)
|
|
179
124
|
|
|
180
|
-
#
|
|
181
|
-
|
|
182
|
-
|
|
125
|
+
# Initialize histogram
|
|
126
|
+
hist_total = np.zeros(
|
|
127
|
+
(len(az_bin_edges) - 1, len(el_bin_edges) - 1, len(energy_bin_edges))
|
|
183
128
|
)
|
|
184
129
|
|
|
185
|
-
|
|
130
|
+
for i, (e_min, e_max) in enumerate(energy_bin_edges):
|
|
131
|
+
# Filter data for current energy bin.
|
|
132
|
+
mask = (energy >= e_min) & (energy < e_max)
|
|
133
|
+
hist, _ = np.histogramdd(
|
|
134
|
+
sample=(az[mask], el[mask], energy[mask]),
|
|
135
|
+
bins=[az_bin_edges, el_bin_edges, [e_min, e_max]],
|
|
136
|
+
)
|
|
137
|
+
# Assign 2D histogram to current energy bin.
|
|
138
|
+
hist_total[:, :, i] = hist[:, :, 0]
|
|
139
|
+
|
|
140
|
+
return hist_total
|
|
186
141
|
|
|
187
142
|
|
|
188
143
|
def get_pointing_frame_exposure_times(
|
|
@@ -211,19 +166,17 @@ def get_pointing_frame_exposure_times(
|
|
|
211
166
|
return exposure
|
|
212
167
|
|
|
213
168
|
|
|
214
|
-
@ensure_spice
|
|
215
|
-
@typing.no_type_check
|
|
216
169
|
def get_helio_exposure_times(
|
|
217
170
|
time: np.ndarray,
|
|
218
171
|
sc_exposure: np.ndarray,
|
|
219
|
-
) ->
|
|
172
|
+
) -> NDArray:
|
|
220
173
|
"""
|
|
221
174
|
Compute a 3D array of the exposure in the helio frame.
|
|
222
175
|
|
|
223
176
|
Parameters
|
|
224
177
|
----------
|
|
225
178
|
time : np.ndarray
|
|
226
|
-
Median time of pointing.
|
|
179
|
+
Median time of pointing in J2000 seconds.
|
|
227
180
|
sc_exposure : np.ndarray
|
|
228
181
|
Spacecraft exposure.
|
|
229
182
|
|
|
@@ -237,7 +190,7 @@ def get_helio_exposure_times(
|
|
|
237
190
|
These calculations are performed once per pointing.
|
|
238
191
|
"""
|
|
239
192
|
# Get bins and midpoints.
|
|
240
|
-
|
|
193
|
+
_, energy_midpoints = build_energy_bins()
|
|
241
194
|
az_bin_edges, el_bin_edges, az_bin_midpoints, el_bin_midpoints = (
|
|
242
195
|
build_spatial_bins()
|
|
243
196
|
)
|
|
@@ -252,15 +205,12 @@ def get_helio_exposure_times(
|
|
|
252
205
|
|
|
253
206
|
# Radial distance.
|
|
254
207
|
r = np.ones(el_grid.shape)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
cartesian = np.vstack(
|
|
259
|
-
[x.flatten(order="F"), y.flatten(order="F"), z.flatten(order="F")]
|
|
260
|
-
)
|
|
208
|
+
spherical_coords = np.stack((r, np.radians(az_grid), np.radians(el_grid)), axis=-1)
|
|
209
|
+
cartesian_coords = spherical_to_cartesian(spherical_coords)
|
|
210
|
+
cartesian = cartesian_coords.reshape(-1, 3, order="F").T
|
|
261
211
|
|
|
262
212
|
# Spacecraft velocity in the pointing (DPS) frame wrt heliosphere.
|
|
263
|
-
state
|
|
213
|
+
state = imap_state(time, ref_frame=SpiceFrame.IMAP_DPS)
|
|
264
214
|
|
|
265
215
|
# Extract the velocity part of the state vector
|
|
266
216
|
spacecraft_velocity = state[3:6]
|
|
@@ -273,7 +223,7 @@ def get_helio_exposure_times(
|
|
|
273
223
|
/ 1e3
|
|
274
224
|
)
|
|
275
225
|
|
|
276
|
-
# Use
|
|
226
|
+
# Use Galilean Transform to transform the velocity wrt spacecraft
|
|
277
227
|
# to the velocity wrt heliosphere.
|
|
278
228
|
# energy_velocity * cartesian -> apply the magnitude of the velocity
|
|
279
229
|
# to every position on the grid in the despun grid.
|
|
@@ -284,10 +234,11 @@ def get_helio_exposure_times(
|
|
|
284
234
|
helio_velocity.T, axis=1, keepdims=True
|
|
285
235
|
)
|
|
286
236
|
# Converts vectors from Cartesian coordinates (x, y, z)
|
|
287
|
-
# into spherical coordinates
|
|
288
|
-
|
|
237
|
+
# into spherical coordinates.
|
|
238
|
+
spherical_coords = cartesian_to_spherical(helio_normalized)
|
|
239
|
+
az, el = spherical_coords[..., 1], spherical_coords[..., 2]
|
|
289
240
|
|
|
290
|
-
#
|
|
241
|
+
# Assign values from sc_exposure directly to bins.
|
|
291
242
|
az_idx = np.digitize(az, az_bin_edges) - 1
|
|
292
243
|
el_idx = np.digitize(el, el_bin_edges[::-1]) - 1
|
|
293
244
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: imap-processing
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: IMAP Science Operations Center Processing
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: IMAP,SDC,SOC,Science Operations
|
|
@@ -41,6 +41,7 @@ Requires-Dist: pytest-cov (>=4.0.0,<5.0.0) ; extra == "test"
|
|
|
41
41
|
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
42
42
|
Requires-Dist: requests (>=2.32.3,<3.0.0) ; extra == "test"
|
|
43
43
|
Requires-Dist: ruff (==0.2.1) ; extra == "dev"
|
|
44
|
+
Requires-Dist: sammi-cdf (>=0.1.2,<0.2.0)
|
|
44
45
|
Requires-Dist: space_packet_parser (>=5.0.1,<6.0.0)
|
|
45
46
|
Requires-Dist: sphinx ; extra == "doc"
|
|
46
47
|
Requires-Dist: sphinxcontrib-openapi (>=0.8.3,<0.9.0) ; extra == "doc"
|
|
@@ -82,21 +83,21 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
82
83
|
<table>
|
|
83
84
|
<tbody>
|
|
84
85
|
<tr>
|
|
85
|
-
<td align="center" valign="top" width="14.28%"><a href="http://greglucas.github.io"><img src="https://avatars.githubusercontent.com/u/12417828?v=4?s=100" width="100px;" alt="Greg Lucas"/><br /><sub><b>Greg Lucas</b></sub></a><br
|
|
86
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tech3371"><img src="https://avatars.githubusercontent.com/u/36522642?v=4?s=100" width="100px;" alt="Tenzin Choedon"/><br /><sub><b>Tenzin Choedon</b></sub></a><br
|
|
87
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/laspsandoval"><img src="https://avatars.githubusercontent.com/u/46567335?v=4?s=100" width="100px;" alt="Laura Sandoval"/><br /><sub><b>Laura Sandoval</b></sub></a><br
|
|
88
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sdhoyt"><img src="https://avatars.githubusercontent.com/u/7146374?v=4?s=100" width="100px;" alt="Sean Hoyt"/><br /><sub><b>Sean Hoyt</b></sub></a><br
|
|
89
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/GFMoraga"><img src="https://avatars.githubusercontent.com/u/104743000?v=4?s=100" width="100px;" alt="Gabriel
|
|
90
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bourque"><img src="https://avatars.githubusercontent.com/u/2250769?v=4?s=100" width="100px;" alt="Matthew Bourque"/><br /><sub><b>Matthew Bourque</b></sub></a><br
|
|
91
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/maxinelasp"><img src="https://avatars.githubusercontent.com/u/117409426?v=4?s=100" width="100px;" alt="Maxine Hartnett"/><br /><sub><b>Maxine Hartnett</b></sub></a><br
|
|
86
|
+
<td align="center" valign="top" width="14.28%"><a href="http://greglucas.github.io"><img src="https://avatars.githubusercontent.com/u/12417828?v=4?s=100" width="100px;" alt="Greg Lucas"/><br /><sub><b>Greg Lucas</b></sub></a><br /></td>
|
|
87
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tech3371"><img src="https://avatars.githubusercontent.com/u/36522642?v=4?s=100" width="100px;" alt="Tenzin Choedon"/><br /><sub><b>Tenzin Choedon</b></sub></a><br /></td>
|
|
88
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/laspsandoval"><img src="https://avatars.githubusercontent.com/u/46567335?v=4?s=100" width="100px;" alt="Laura Sandoval"/><br /><sub><b>Laura Sandoval</b></sub></a><br /></td>
|
|
89
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sdhoyt"><img src="https://avatars.githubusercontent.com/u/7146374?v=4?s=100" width="100px;" alt="Sean Hoyt"/><br /><sub><b>Sean Hoyt</b></sub></a><br /></td>
|
|
90
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/GFMoraga"><img src="https://avatars.githubusercontent.com/u/104743000?v=4?s=100" width="100px;" alt="Gabriel Moraga"/><br /><sub><b>Gabriel Moraga</b></sub></a><br /></td>
|
|
91
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bourque"><img src="https://avatars.githubusercontent.com/u/2250769?v=4?s=100" width="100px;" alt="Matthew Bourque"/><br /><sub><b>Matthew Bourque</b></sub></a><br /></td>
|
|
92
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/maxinelasp"><img src="https://avatars.githubusercontent.com/u/117409426?v=4?s=100" width="100px;" alt="Maxine Hartnett"/><br /><sub><b>Maxine Hartnett</b></sub></a><br /></td>
|
|
92
93
|
</tr>
|
|
93
94
|
<tr>
|
|
94
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bryan-harter"><img src="https://avatars.githubusercontent.com/u/41062454?v=4?s=100" width="100px;" alt="Bryan Harter"/><br /><sub><b>Bryan Harter</b></sub></a><br
|
|
95
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mstrumik"><img src="https://avatars.githubusercontent.com/u/142874888?v=4?s=100" width="100px;" alt="
|
|
96
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vmartinez-cu"><img src="https://avatars.githubusercontent.com/u/39746325?v=4?s=100" width="100px;" alt="
|
|
97
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/subagonsouth"><img src="https://avatars.githubusercontent.com/u/16110870?v=4?s=100" width="100px;" alt="Tim Plummer"/><br /><sub><b>Tim Plummer</b></sub></a><br
|
|
98
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/daralynnrhode"><img src="https://avatars.githubusercontent.com/u/143308810?v=4?s=100" width="100px;" alt="Daralynn Rhode"/><br /><sub><b>Daralynn Rhode</b></sub></a><br
|
|
99
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anamanica"><img src="https://avatars.githubusercontent.com/u/171708990?v=4?s=100" width="100px;" alt="
|
|
95
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bryan-harter"><img src="https://avatars.githubusercontent.com/u/41062454?v=4?s=100" width="100px;" alt="Bryan Harter"/><br /><sub><b>Bryan Harter</b></sub></a><br /></td>
|
|
96
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mstrumik"><img src="https://avatars.githubusercontent.com/u/142874888?v=4?s=100" width="100px;" alt="Marek Strumik"/><br /><sub><b>Marek Strumik</b></sub></a><br /></td>
|
|
97
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vmartinez-cu"><img src="https://avatars.githubusercontent.com/u/39746325?v=4?s=100" width="100px;" alt="Veronica Martinez"/><br /><sub><b>Veronica Martinez</b></sub></a><br /></td>
|
|
98
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/subagonsouth"><img src="https://avatars.githubusercontent.com/u/16110870?v=4?s=100" width="100px;" alt="Tim Plummer"/><br /><sub><b>Tim Plummer</b></sub></a><br /></td>
|
|
99
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/daralynnrhode"><img src="https://avatars.githubusercontent.com/u/143308810?v=4?s=100" width="100px;" alt="Daralynn Rhode"/><br /><sub><b>Daralynn Rhode</b></sub></a><br /></td>
|
|
100
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anamanica"><img src="https://avatars.githubusercontent.com/u/171708990?v=4?s=100" width="100px;" alt="Ana Manica"/><br /><sub><b>Ana Manica</b></sub></a><br /></td>
|
|
100
101
|
</tr>
|
|
101
102
|
</tbody>
|
|
102
103
|
</table>
|