autowisp 1.0.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.
- autowisp/__init__.py +20 -0
- autowisp/astrometry/__init__.py +11 -0
- autowisp/astrometry/anmatch_transformation.py +175 -0
- autowisp/astrometry/astrometry.py +661 -0
- autowisp/astrometry/astrometry_net_client.py +706 -0
- autowisp/astrometry/healpix_utilities.py +59 -0
- autowisp/astrometry/map_projections.py +99 -0
- autowisp/astrometry/transformation.py +284 -0
- autowisp/catalog.py +1244 -0
- autowisp/data_reduction/__init__.py +4 -0
- autowisp/data_reduction/data_reduction_file.py +1131 -0
- autowisp/data_reduction/source_extracted_psf_map.py +73 -0
- autowisp/data_reduction/utils.py +557 -0
- autowisp/database/__init__.py +0 -0
- autowisp/database/autowisp.db +0 -0
- autowisp/database/data_model/__init__.py +88 -0
- autowisp/database/data_model/base.py +29 -0
- autowisp/database/data_model/condition.py +40 -0
- autowisp/database/data_model/condition_expression.py +34 -0
- autowisp/database/data_model/configuration.py +73 -0
- autowisp/database/data_model/hdf5_attributes.py +90 -0
- autowisp/database/data_model/hdf5_datasets.py +130 -0
- autowisp/database/data_model/hdf5_links.py +61 -0
- autowisp/database/data_model/hdf5_products.py +44 -0
- autowisp/database/data_model/hdf5_structure_versions.py +46 -0
- autowisp/database/data_model/image.py +186 -0
- autowisp/database/data_model/image_type.py +37 -0
- autowisp/database/data_model/input_master_types.py +60 -0
- autowisp/database/data_model/light_curve_processing_progress.py +81 -0
- autowisp/database/data_model/light_curve_status.py +38 -0
- autowisp/database/data_model/master_files.py +119 -0
- autowisp/database/data_model/observing_session.py +96 -0
- autowisp/database/data_model/processing_sequence.py +34 -0
- autowisp/database/data_model/provenance/__init__.py +58 -0
- autowisp/database/data_model/provenance/camera.py +56 -0
- autowisp/database/data_model/provenance/camera_access.py +34 -0
- autowisp/database/data_model/provenance/camera_channel.py +58 -0
- autowisp/database/data_model/provenance/camera_type.py +45 -0
- autowisp/database/data_model/provenance/mount.py +54 -0
- autowisp/database/data_model/provenance/mount_access.py +33 -0
- autowisp/database/data_model/provenance/mount_type.py +33 -0
- autowisp/database/data_model/provenance/observatory.py +42 -0
- autowisp/database/data_model/provenance/observer.py +55 -0
- autowisp/database/data_model/provenance/telescope.py +51 -0
- autowisp/database/data_model/provenance/telescope_access.py +33 -0
- autowisp/database/data_model/provenance/telescope_type.py +41 -0
- autowisp/database/data_model/step_dependencies.py +71 -0
- autowisp/database/data_model/steps_and_parameters.py +74 -0
- autowisp/database/data_model/target.py +38 -0
- autowisp/database/hdf5_file_structure.py +115 -0
- autowisp/database/image_processing.py +1408 -0
- autowisp/database/initialize_data_reduction_structure.py +1320 -0
- autowisp/database/initialize_database.py +701 -0
- autowisp/database/initialize_light_curve_structure.py +1061 -0
- autowisp/database/interface.py +24 -0
- autowisp/database/lightcurve_processing.py +602 -0
- autowisp/database/manually_fill_tables.py +152 -0
- autowisp/database/processing.py +891 -0
- autowisp/database/user_interface.py +678 -0
- autowisp/diagnostics/detrending.py +168 -0
- autowisp/diagnostics/plot_lc.py +335 -0
- autowisp/evaluator.py +154 -0
- autowisp/file_utilities.py +111 -0
- autowisp/fit_expression/FitTermsLexer.py +570 -0
- autowisp/fit_expression/FitTermsParser.py +914 -0
- autowisp/fit_expression/FitTermsParserListener.py +71 -0
- autowisp/fit_expression/FitTermsParserVisitor.py +44 -0
- autowisp/fit_expression/__init__.py +7 -0
- autowisp/fit_expression/count_terms_visitor.py +57 -0
- autowisp/fit_expression/evaluate_terms_visitor.py +124 -0
- autowisp/fit_expression/interface.py +69 -0
- autowisp/fit_expression/iterative_fit.py +290 -0
- autowisp/fit_expression/list_terms_visitor.py +82 -0
- autowisp/fit_expression/process_terms_visitor.py +180 -0
- autowisp/fit_expression/used_var_finder.py +32 -0
- autowisp/fits_utilities.py +186 -0
- autowisp/hat/file_parsers.py +136 -0
- autowisp/hat/header_util.py +7 -0
- autowisp/hdf5_file.py +1338 -0
- autowisp/image_calibration/__init__.py +15 -0
- autowisp/image_calibration/calibrator.py +797 -0
- autowisp/image_calibration/fits_util.py +340 -0
- autowisp/image_calibration/mask_utilities.py +138 -0
- autowisp/image_calibration/master_flat_maker.py +863 -0
- autowisp/image_calibration/master_maker.py +441 -0
- autowisp/image_calibration/overscan_methods.py +330 -0
- autowisp/image_smoothing.py +630 -0
- autowisp/image_utilities.py +305 -0
- autowisp/iterative_rejection_util.py +364 -0
- autowisp/light_curves/__init__.py +0 -0
- autowisp/light_curves/apply_correction.py +343 -0
- autowisp/light_curves/collect_light_curves.py +177 -0
- autowisp/light_curves/correction.py +312 -0
- autowisp/light_curves/epd_correction.py +418 -0
- autowisp/light_curves/hashable_array.py +64 -0
- autowisp/light_curves/lc_data_io.py +1395 -0
- autowisp/light_curves/lc_data_slice.py +163 -0
- autowisp/light_curves/light_curve_file.py +705 -0
- autowisp/light_curves/reconstructive_correction_transit.py +119 -0
- autowisp/light_curves/tfa_correction.py +1147 -0
- autowisp/light_curves/transit_model.py +40 -0
- autowisp/magnitude_fitting/__init__.py +11 -0
- autowisp/magnitude_fitting/base.py +598 -0
- autowisp/magnitude_fitting/iterative_refit.py +351 -0
- autowisp/magnitude_fitting/linear.py +258 -0
- autowisp/magnitude_fitting/master_photref_collector_grcollect.py +717 -0
- autowisp/magnitude_fitting/master_photref_collector_zarr.py +702 -0
- autowisp/magnitude_fitting/util.py +193 -0
- autowisp/miscellaneous.py +11 -0
- autowisp/multiprocessing_util.py +172 -0
- autowisp/piecewise_bicubic_psf_map.py +229 -0
- autowisp/pipeline_exceptions.py +23 -0
- autowisp/processing_steps/__init__.py +26 -0
- autowisp/processing_steps/add_images_to_db.py +452 -0
- autowisp/processing_steps/calculate_photref_merit.py +319 -0
- autowisp/processing_steps/calibrate.py +339 -0
- autowisp/processing_steps/create_lightcurves.py +397 -0
- autowisp/processing_steps/epd.py +64 -0
- autowisp/processing_steps/find_stars.py +166 -0
- autowisp/processing_steps/fit_magnitudes.py +476 -0
- autowisp/processing_steps/fit_source_extracted_psf_map.py +339 -0
- autowisp/processing_steps/fit_star_shape.py +830 -0
- autowisp/processing_steps/generate_epd_statistics.py +48 -0
- autowisp/processing_steps/generate_tfa_statistics.py +48 -0
- autowisp/processing_steps/lc_detrending.py +235 -0
- autowisp/processing_steps/lc_detrending_argument_parser.py +590 -0
- autowisp/processing_steps/manual_util.py +580 -0
- autowisp/processing_steps/measure_aperture_photometry.py +262 -0
- autowisp/processing_steps/solve_astrometry.py +875 -0
- autowisp/processing_steps/stack_to_master.py +240 -0
- autowisp/processing_steps/stack_to_master_flat.py +515 -0
- autowisp/processing_steps/tfa.py +85 -0
- autowisp/processor.py +28 -0
- autowisp/resources/dslr_subpixmap.fits +0 -0
- autowisp/source_finder.py +184 -0
- autowisp/source_finder_util.py +61 -0
- autowisp/split_sources.py +197 -0
- autowisp/tess_interface.py +143 -0
- autowisp/tests/__init__.py +95 -0
- autowisp/tests/__main__.py +51 -0
- autowisp/tests/fits_test_case.py +83 -0
- autowisp/tests/get_test_data.py +37 -0
- autowisp/tests/h5_test_case.py +165 -0
- autowisp/tests/test_calibrate.py +85 -0
- autowisp/tests/test_create_lightcurves.py +28 -0
- autowisp/tests/test_detrending_stat.py +51 -0
- autowisp/tests/test_epd.py +20 -0
- autowisp/tests/test_find_stars.py +18 -0
- autowisp/tests/test_fit_magnitudes.py +20 -0
- autowisp/tests/test_fit_source_extracted_psf_map.py +16 -0
- autowisp/tests/test_fit_star_shape.py +18 -0
- autowisp/tests/test_measure_aperture_photometry.py +25 -0
- autowisp/tests/test_solve_astrometry.py +16 -0
- autowisp/tests/test_stack_to_master.py +49 -0
- autowisp/tests/test_tfa.py +20 -0
- autowisp-1.0.0.dist-info/LICENSE +21 -0
- autowisp-1.0.0.dist-info/METADATA +76 -0
- autowisp-1.0.0.dist-info/RECORD +160 -0
- autowisp-1.0.0.dist-info/WHEEL +4 -0
- autowisp-1.0.0.dist-info/entry_points.txt +16 -0
autowisp/__init__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""A general purpose AstroWISP based photometry pipeline."""
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from autowisp.processor import Processor
|
|
5
|
+
from autowisp.data_reduction.data_reduction_file import (
|
|
6
|
+
DataReductionFile,
|
|
7
|
+
init_dr_process,
|
|
8
|
+
)
|
|
9
|
+
from autowisp.light_curves.light_curve_file import LightCurveFile
|
|
10
|
+
from autowisp.light_curves.epd_correction import EPDCorrection
|
|
11
|
+
from autowisp.light_curves.tfa_correction import TFACorrection
|
|
12
|
+
from autowisp.source_finder import SourceFinder
|
|
13
|
+
from autowisp.piecewise_bicubic_psf_map import PiecewiseBicubicPSFMap
|
|
14
|
+
|
|
15
|
+
# pylint: disable=bare-except
|
|
16
|
+
except:
|
|
17
|
+
# pylint: enable=bare-except
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
from autowisp.evaluator import Evaluator
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Module implementing the low-level astrometry."""
|
|
2
|
+
|
|
3
|
+
from autowisp.astrometry.transformation import Transformation
|
|
4
|
+
from autowisp.astrometry.anmatch_transformation import AnmatchTransformation
|
|
5
|
+
from autowisp.astrometry.astrometry import (
|
|
6
|
+
estimate_transformation,
|
|
7
|
+
refine_transformation,
|
|
8
|
+
find_ra_dec,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
__all__ = ["Transformation", "AnmatchTransformation"]
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""Define a class to apply sky-to-frame transformations found by anmatch."""
|
|
2
|
+
|
|
3
|
+
import os.path
|
|
4
|
+
import numpy
|
|
5
|
+
|
|
6
|
+
from autowisp.astrometry.map_projections import gnomonic_projection
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AnmatchTransformation:
|
|
10
|
+
"""A clas that applies transformations generated by anmatch."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, trans_file=None):
|
|
13
|
+
"""
|
|
14
|
+
Parse the transformation to apply from the given file.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
trans_file: The transformation file contaning the transformation
|
|
18
|
+
to apply. If this is the name of an existing file, it is opened
|
|
19
|
+
and parsed, otherwise this should be a sequence of the lines
|
|
20
|
+
contained in the transfomation file.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
None
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
self.coefficients = {"x": [], "y": []}
|
|
27
|
+
if trans_file is not None:
|
|
28
|
+
if os.path.exists(trans_file):
|
|
29
|
+
with open(trans_file, encoding="ascii") as trans_lines:
|
|
30
|
+
self.read_anmatch_transformation(trans_lines)
|
|
31
|
+
else:
|
|
32
|
+
self.read_anmatch_transformation(trans_file)
|
|
33
|
+
|
|
34
|
+
def read_anmatch_transformation(self, trans_lines):
|
|
35
|
+
"""
|
|
36
|
+
Parse the transformation to apply from the given file.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
trans_lines: A sequence of the individual lines of the trans file
|
|
40
|
+
defining the transformation to apply.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
None
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
for line in trans_lines:
|
|
47
|
+
if line[0] == "#":
|
|
48
|
+
if line[1:].strip().startswith("2MASS:"):
|
|
49
|
+
# ra is perfectly reasonable for sky position
|
|
50
|
+
# pylint: disable=invalid-name
|
|
51
|
+
ra, dec = map(float, line[1:].strip().split()[1:3])
|
|
52
|
+
# pylint: enable=invalid-name
|
|
53
|
+
self.center = {"RA": ra, "Dec": dec}
|
|
54
|
+
else:
|
|
55
|
+
key, value = map(str.strip, line.split("="))
|
|
56
|
+
if key == "type":
|
|
57
|
+
assert value == "polynomial"
|
|
58
|
+
elif key == "order":
|
|
59
|
+
self.order = int(value)
|
|
60
|
+
elif key == "offset":
|
|
61
|
+
assert value == "0, 0"
|
|
62
|
+
elif key == "scale":
|
|
63
|
+
assert value == "1"
|
|
64
|
+
elif key == "basisshift":
|
|
65
|
+
assert value == "0, 0"
|
|
66
|
+
elif (
|
|
67
|
+
key[0] == "d" and key[1] in ["x", "y"] and key[2:] == "fit"
|
|
68
|
+
):
|
|
69
|
+
self.coefficients[key[1]] = [
|
|
70
|
+
float(word.strip()) for word in value.split(",")
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
assert (
|
|
74
|
+
len(self.coefficients["x"])
|
|
75
|
+
== (self.order + 1) * (self.order + 2) // 2
|
|
76
|
+
)
|
|
77
|
+
assert (
|
|
78
|
+
len(self.coefficients["y"])
|
|
79
|
+
== (self.order + 1) * (self.order + 2) // 2
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def evaluate_polynomial(self, projected, transformed):
|
|
83
|
+
"""
|
|
84
|
+
Apply the currently defined polynomial transfomation to (xi, eta).
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
projected: The projected (c.f. gnomonic_projection()) coordinates
|
|
88
|
+
to transform. Should have `'xi'` and `'eta'` keys containing the
|
|
89
|
+
projected coordinates to transform in degrees.
|
|
90
|
+
|
|
91
|
+
transformed: A numpy array with `'x'` and `'y'` fields to fill
|
|
92
|
+
with the transformed coordinates (in pixels).
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
None
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
transformed["x"] = transformed["y"] = 0.0
|
|
99
|
+
|
|
100
|
+
xi_to_order = 1.0
|
|
101
|
+
order_factorial = 1.0
|
|
102
|
+
coef_index = 0
|
|
103
|
+
for order in range(self.order + 1):
|
|
104
|
+
|
|
105
|
+
xi_term = numpy.copy(xi_to_order)
|
|
106
|
+
eta_term = 1.0
|
|
107
|
+
|
|
108
|
+
xi_factor = order_factorial
|
|
109
|
+
eta_factor = 1.0
|
|
110
|
+
|
|
111
|
+
for eta_power in range(order + 1):
|
|
112
|
+
for out_var in ["x", "y"]:
|
|
113
|
+
transformed[out_var] += (
|
|
114
|
+
self.coefficients[out_var][coef_index]
|
|
115
|
+
* xi_term
|
|
116
|
+
* eta_term
|
|
117
|
+
/ xi_factor
|
|
118
|
+
/ eta_factor
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
coef_index += 1
|
|
122
|
+
if eta_power < order:
|
|
123
|
+
xi_term /= projected["xi"]
|
|
124
|
+
eta_term *= projected["eta"]
|
|
125
|
+
|
|
126
|
+
xi_factor /= order - eta_power
|
|
127
|
+
eta_factor *= eta_power + 1
|
|
128
|
+
|
|
129
|
+
order_factorial *= order + 1
|
|
130
|
+
xi_to_order *= projected["xi"]
|
|
131
|
+
|
|
132
|
+
def __call__(self, sources, save_intermediate=False):
|
|
133
|
+
"""
|
|
134
|
+
Return the x and y coordinates to which the given (ra, dec) project to.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
sources: The sky position to project to frame coordinates. Should
|
|
138
|
+
have keys named `'RA'` and `'Dec'` in degrees.
|
|
139
|
+
|
|
140
|
+
save_intermediate: Should the intermediate coordinates be saved.
|
|
141
|
+
Those are the coordinates after apllying the sky projection and
|
|
142
|
+
before applying the polynomial transformation.
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
numpy.array(dtype=[('x', float), ('y', float)]):
|
|
146
|
+
The position in pixels relative to the lower left frame of the
|
|
147
|
+
corner to which the given sky position projects under the
|
|
148
|
+
currently defined transformation, as a numpy array with fields
|
|
149
|
+
named `'x'` and `'y'`. If `save_intermediate` is True, the
|
|
150
|
+
result also contains fields called `'xi'` and `'eta'` containing
|
|
151
|
+
the intermediate coordinates."""
|
|
152
|
+
|
|
153
|
+
try:
|
|
154
|
+
projected_shape = sources["RA"].shape
|
|
155
|
+
except TypeError:
|
|
156
|
+
projected_shape = (1,)
|
|
157
|
+
|
|
158
|
+
# pylint false positive
|
|
159
|
+
# pylint: disable=no-member
|
|
160
|
+
projected_dtype = [("x", numpy.float64), ("y", numpy.float64)]
|
|
161
|
+
intermediate_dtype = [("xi", numpy.float64), ("eta", numpy.float64)]
|
|
162
|
+
# pylint: enable=no-member
|
|
163
|
+
if save_intermediate:
|
|
164
|
+
projected_dtype.extend(intermediate_dtype)
|
|
165
|
+
|
|
166
|
+
projected = numpy.empty(projected_shape, dtype=projected_dtype)
|
|
167
|
+
intermediate = (
|
|
168
|
+
projected
|
|
169
|
+
if save_intermediate
|
|
170
|
+
else numpy.empty(projected_shape, intermediate_dtype)
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
gnomonic_projection(sources, intermediate, **self.center)
|
|
174
|
+
self.evaluate_polynomial(intermediate, projected)
|
|
175
|
+
return projected
|