pyreduce-astro 0.7a6__cp314-cp314-win_amd64.whl → 0.7a7__cp314-cp314-win_amd64.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.
- pyreduce/__main__.py +34 -4
- pyreduce/clib/Release/_slitfunc_2d.obj +0 -0
- pyreduce/clib/Release/_slitfunc_bd.obj +0 -0
- pyreduce/clib/_slitfunc_2d.cp313-win_amd64.pyd +0 -0
- pyreduce/clib/_slitfunc_2d.cp314-win_amd64.pyd +0 -0
- pyreduce/clib/_slitfunc_bd.cp313-win_amd64.pyd +0 -0
- pyreduce/clib/_slitfunc_bd.cp314-win_amd64.pyd +0 -0
- pyreduce/configuration.py +20 -0
- pyreduce/estimate_background_scatter.py +8 -8
- pyreduce/extract.py +126 -126
- pyreduce/{extraction_width.py → extraction_height.py} +4 -4
- pyreduce/make_shear.py +12 -12
- pyreduce/rectify.py +10 -10
- pyreduce/reduce.py +9 -9
- pyreduce/settings/settings_AJ.json +1 -1
- pyreduce/settings/settings_ANDES.json +6 -6
- pyreduce/settings/settings_CRIRES_PLUS.json +6 -6
- pyreduce/settings/settings_HARPN.json +6 -6
- pyreduce/settings/settings_HARPS.json +6 -6
- pyreduce/settings/settings_JWST_MIRI.json +6 -6
- pyreduce/settings/settings_JWST_NIRISS.json +6 -6
- pyreduce/settings/settings_LICK_APF.json +6 -6
- pyreduce/settings/settings_MCDONALD.json +6 -6
- pyreduce/settings/settings_METIS_IFU.json +6 -6
- pyreduce/settings/settings_METIS_LSS.json +6 -6
- pyreduce/settings/settings_MICADO.json +6 -6
- pyreduce/settings/settings_NEID.json +6 -6
- pyreduce/settings/settings_NIRSPEC.json +6 -6
- pyreduce/settings/settings_NTE.json +5 -5
- pyreduce/settings/settings_UVES.json +3 -3
- pyreduce/settings/settings_XSHOOTER.json +4 -4
- pyreduce/settings/settings_pyreduce.json +7 -7
- pyreduce/settings/settings_schema.json +7 -7
- {pyreduce_astro-0.7a6.dist-info → pyreduce_astro-0.7a7.dist-info}/METADATA +2 -2
- {pyreduce_astro-0.7a6.dist-info → pyreduce_astro-0.7a7.dist-info}/RECORD +38 -38
- {pyreduce_astro-0.7a6.dist-info → pyreduce_astro-0.7a7.dist-info}/WHEEL +0 -0
- {pyreduce_astro-0.7a6.dist-info → pyreduce_astro-0.7a7.dist-info}/entry_points.txt +0 -0
- {pyreduce_astro-0.7a6.dist-info → pyreduce_astro-0.7a7.dist-info}/licenses/LICENSE +0 -0
pyreduce/__main__.py
CHANGED
|
@@ -67,6 +67,12 @@ def cli():
|
|
|
67
67
|
default=None,
|
|
68
68
|
help="Order range to process (e.g., '1,21')",
|
|
69
69
|
)
|
|
70
|
+
@click.option(
|
|
71
|
+
"--settings",
|
|
72
|
+
default=None,
|
|
73
|
+
type=click.Path(exists=True),
|
|
74
|
+
help="JSON file with settings overrides",
|
|
75
|
+
)
|
|
70
76
|
def run(
|
|
71
77
|
instrument,
|
|
72
78
|
target,
|
|
@@ -78,13 +84,14 @@ def run(
|
|
|
78
84
|
output_dir,
|
|
79
85
|
plot,
|
|
80
86
|
order_range,
|
|
87
|
+
settings,
|
|
81
88
|
):
|
|
82
89
|
"""Run the reduction pipeline.
|
|
83
90
|
|
|
84
91
|
INSTRUMENT: Name of the instrument (e.g., UVES, HARPS, XSHOOTER)
|
|
85
92
|
TARGET: Target star name or regex pattern
|
|
86
93
|
"""
|
|
87
|
-
from .configuration import get_configuration_for_instrument
|
|
94
|
+
from .configuration import get_configuration_for_instrument, load_settings_override
|
|
88
95
|
from .reduce import main as reduce_main
|
|
89
96
|
|
|
90
97
|
# Parse steps
|
|
@@ -100,6 +107,8 @@ def run(
|
|
|
100
107
|
|
|
101
108
|
# Load configuration
|
|
102
109
|
config = get_configuration_for_instrument(instrument)
|
|
110
|
+
if settings:
|
|
111
|
+
config = load_settings_override(config, settings)
|
|
103
112
|
|
|
104
113
|
# Run reduction
|
|
105
114
|
reduce_main(
|
|
@@ -292,10 +301,28 @@ def make_step_command(step_name):
|
|
|
292
301
|
default=None,
|
|
293
302
|
help="Specific input file (bypasses file discovery)",
|
|
294
303
|
)
|
|
304
|
+
@click.option(
|
|
305
|
+
"--settings",
|
|
306
|
+
default=None,
|
|
307
|
+
type=click.Path(exists=True),
|
|
308
|
+
help="JSON file with settings overrides",
|
|
309
|
+
)
|
|
295
310
|
def cmd(
|
|
296
|
-
instrument,
|
|
311
|
+
instrument,
|
|
312
|
+
target,
|
|
313
|
+
night,
|
|
314
|
+
channel,
|
|
315
|
+
base_dir,
|
|
316
|
+
input_dir,
|
|
317
|
+
output_dir,
|
|
318
|
+
plot,
|
|
319
|
+
file,
|
|
320
|
+
settings,
|
|
297
321
|
):
|
|
298
|
-
from .configuration import
|
|
322
|
+
from .configuration import (
|
|
323
|
+
get_configuration_for_instrument,
|
|
324
|
+
load_settings_override,
|
|
325
|
+
)
|
|
299
326
|
from .reduce import main as reduce_main
|
|
300
327
|
|
|
301
328
|
if file:
|
|
@@ -305,7 +332,6 @@ def make_step_command(step_name):
|
|
|
305
332
|
import numpy as np
|
|
306
333
|
|
|
307
334
|
from . import reduce as reduce_module
|
|
308
|
-
from .configuration import get_configuration_for_instrument
|
|
309
335
|
from .instruments.instrument_info import load_instrument
|
|
310
336
|
|
|
311
337
|
inst = load_instrument(instrument)
|
|
@@ -317,6 +343,8 @@ def make_step_command(step_name):
|
|
|
317
343
|
|
|
318
344
|
# Load configuration for this step
|
|
319
345
|
config = get_configuration_for_instrument(instrument)
|
|
346
|
+
if settings:
|
|
347
|
+
config = load_settings_override(config, settings)
|
|
320
348
|
step_config = config.get(step_name, {})
|
|
321
349
|
step_config["plot"] = plot
|
|
322
350
|
|
|
@@ -355,6 +383,8 @@ def make_step_command(step_name):
|
|
|
355
383
|
step.run(files=np.array([file]), mask=None, bias=None)
|
|
356
384
|
else:
|
|
357
385
|
config = get_configuration_for_instrument(instrument)
|
|
386
|
+
if settings:
|
|
387
|
+
config = load_settings_override(config, settings)
|
|
358
388
|
reduce_main(
|
|
359
389
|
instrument=instrument,
|
|
360
390
|
target=target,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
pyreduce/configuration.py
CHANGED
|
@@ -43,6 +43,26 @@ def get_configuration_for_instrument(instrument, **kwargs):
|
|
|
43
43
|
return config
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
def load_settings_override(config, settings_file):
|
|
47
|
+
"""Apply settings overrides from a JSON file.
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
config : dict
|
|
52
|
+
Base configuration to override
|
|
53
|
+
settings_file : str
|
|
54
|
+
Path to JSON file with override settings
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
config : dict
|
|
59
|
+
Updated configuration
|
|
60
|
+
"""
|
|
61
|
+
with open(settings_file) as f:
|
|
62
|
+
overrides = json.load(f)
|
|
63
|
+
return update(config, overrides, check=False)
|
|
64
|
+
|
|
65
|
+
|
|
46
66
|
def load_config(configuration, instrument, j=0):
|
|
47
67
|
if configuration is None:
|
|
48
68
|
logger.info(
|
|
@@ -18,7 +18,7 @@ def estimate_background_scatter(
|
|
|
18
18
|
img,
|
|
19
19
|
orders,
|
|
20
20
|
column_range=None,
|
|
21
|
-
|
|
21
|
+
extraction_height=0.1,
|
|
22
22
|
scatter_degree=4,
|
|
23
23
|
sigma_cutoff=2,
|
|
24
24
|
border_width=10,
|
|
@@ -38,7 +38,7 @@ def estimate_background_scatter(
|
|
|
38
38
|
order polynomial coefficients
|
|
39
39
|
column_range : array[nord, 2], optional
|
|
40
40
|
range of columns to use in each order (default: None == all columns)
|
|
41
|
-
|
|
41
|
+
extraction_height : float, array[nord, 2], optional
|
|
42
42
|
extraction width for each order, values below 1.5 are considered fractional, others as number of pixels (default: 0.1)
|
|
43
43
|
scatter_degree : int, optional
|
|
44
44
|
polynomial degree of the 2d fit for the background scatter (default: 4)
|
|
@@ -56,8 +56,8 @@ def estimate_background_scatter(
|
|
|
56
56
|
nrow, ncol = img.shape
|
|
57
57
|
nord, _ = orders.shape
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
extraction_height, column_range, orders = fix_parameters(
|
|
60
|
+
extraction_height,
|
|
61
61
|
column_range,
|
|
62
62
|
orders,
|
|
63
63
|
nrow,
|
|
@@ -73,16 +73,16 @@ def estimate_background_scatter(
|
|
|
73
73
|
mask[:bw] = mask[-bw:] = mask[:, :bw] = mask[:, -bw:] = False
|
|
74
74
|
for i in range(nord):
|
|
75
75
|
left, right = column_range[i]
|
|
76
|
-
left -=
|
|
77
|
-
right +=
|
|
76
|
+
left -= extraction_height[i, 1] * 2
|
|
77
|
+
right += extraction_height[i, 0] * 2
|
|
78
78
|
left = max(0, left)
|
|
79
79
|
right = min(ncol, right)
|
|
80
80
|
|
|
81
81
|
x_order = np.arange(left, right)
|
|
82
82
|
y_order = np.polyval(orders[i], x_order)
|
|
83
83
|
|
|
84
|
-
y_above = y_order +
|
|
85
|
-
y_below = y_order -
|
|
84
|
+
y_above = y_order + extraction_height[i, 1]
|
|
85
|
+
y_below = y_order - extraction_height[i, 0]
|
|
86
86
|
|
|
87
87
|
y_above = np.floor(y_above)
|
|
88
88
|
y_below = np.ceil(y_below)
|