sdss-almanac 0.2.6__tar.gz → 0.2.8__tar.gz
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.
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/PKG-INFO +1 -1
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/pyproject.toml +1 -1
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/__init__.py +1 -1
- sdss_almanac-0.2.8/src/almanac/catalog.py +262 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/cli.py +98 -2
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/data_models/exposure.py +8 -2
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/data_models/types.py +1 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/sdss_almanac.egg-info/PKG-INFO +1 -1
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/sdss_almanac.egg-info/SOURCES.txt +1 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/LICENSE.md +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/README.md +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/setup.cfg +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/apogee.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/config.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/data_models/__init__.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/data_models/fps.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/data_models/plate.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/data_models/utils.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/database.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/display.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/etc/__init__.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/etc/bad_exposures.csv +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/io.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/logger.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/qa.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/stash/data_models.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/stash/plugmap_models.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/almanac/utils.py +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/sdss_almanac.egg-info/dependency_links.txt +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/sdss_almanac.egg-info/entry_points.txt +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/sdss_almanac.egg-info/not-zip-safe +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/sdss_almanac.egg-info/requires.txt +0 -0
- {sdss_almanac-0.2.6 → sdss_almanac-0.2.8}/src/sdss_almanac.egg-info/top_level.txt +0 -0
@@ -0,0 +1,262 @@
|
|
1
|
+
from itertools import batched
|
2
|
+
from typing import List
|
3
|
+
from peewee import JOIN
|
4
|
+
|
5
|
+
def query_catalog(sdss_ids: List[int], batch_size: int = 1000):
|
6
|
+
"""
|
7
|
+
Query the SDSS database for photometry and astrometry.
|
8
|
+
"""
|
9
|
+
|
10
|
+
sdss_ids = sorted(list(set(sdss_ids).difference({0, -1})))
|
11
|
+
|
12
|
+
from almanac.database import is_database_available, catalogdb as db
|
13
|
+
|
14
|
+
for batch in batched(sdss_ids, batch_size):
|
15
|
+
q = (
|
16
|
+
db
|
17
|
+
.SDSS_ID_To_Catalog
|
18
|
+
.select(
|
19
|
+
db.SDSS_ID_To_Catalog.sdss_id,
|
20
|
+
#db.SDSS_ID_To_Catalog.catalogid,
|
21
|
+
#db.SDSS_ID_To_Catalog.version_id,
|
22
|
+
#db.SDSS_ID_To_Catalog.lead,
|
23
|
+
#db.SDSS_ID_To_Catalog.allstar_dr17_synspec_rev1,
|
24
|
+
#db.SDSS_ID_To_Catalog.allwise,
|
25
|
+
#db.SDSS_ID_To_Catalog.bhm_rm_v0,
|
26
|
+
#db.SDSS_ID_To_Catalog.bhm_rm_v0_2,
|
27
|
+
#db.SDSS_ID_To_Catalog.catwise,
|
28
|
+
#db.SDSS_ID_To_Catalog.catwise2020,
|
29
|
+
#db.SDSS_ID_To_Catalog.gaia_dr2_source,
|
30
|
+
#db.SDSS_ID_To_Catalog.gaia_dr3_source,
|
31
|
+
#db.SDSS_ID_To_Catalog.glimpse,
|
32
|
+
#db.SDSS_ID_To_Catalog.guvcat,
|
33
|
+
#db.SDSS_ID_To_Catalog.legacy_survey_dr10,
|
34
|
+
#db.SDSS_ID_To_Catalog.legacy_survey_dr8,
|
35
|
+
#db.SDSS_ID_To_Catalog.mangatarget,
|
36
|
+
#db.SDSS_ID_To_Catalog.marvels_dr11_star,
|
37
|
+
#db.SDSS_ID_To_Catalog.marvels_dr12_star,
|
38
|
+
#db.SDSS_ID_To_Catalog.mastar_goodstars,
|
39
|
+
#db.SDSS_ID_To_Catalog.panstarrs1,
|
40
|
+
#db.SDSS_ID_To_Catalog.ps1_g18,
|
41
|
+
#db.SDSS_ID_To_Catalog.sdss_dr13_photoobj,
|
42
|
+
#db.SDSS_ID_To_Catalog.sdss_dr17_specobj,
|
43
|
+
#db.SDSS_ID_To_Catalog.skymapper_dr1_1,
|
44
|
+
#db.SDSS_ID_To_Catalog.skymapper_dr2,
|
45
|
+
#db.SDSS_ID_To_Catalog.supercosmos,
|
46
|
+
#db.SDSS_ID_To_Catalog.tic_v8,
|
47
|
+
#db.SDSS_ID_To_Catalog.twomass_psc,
|
48
|
+
#db.SDSS_ID_To_Catalog.tycho2,
|
49
|
+
#db.SDSS_ID_To_Catalog.unwise,
|
50
|
+
db.Gaia_DR3.source_id,
|
51
|
+
#db.Gaia_DR3.solution_id,
|
52
|
+
#db.Gaia_DR3.designation,
|
53
|
+
#db.Gaia_DR3.random_index,
|
54
|
+
#db.Gaia_DR3.ref_epoch,
|
55
|
+
db.Gaia_DR3.ra,
|
56
|
+
#db.Gaia_DR3.ra_error,
|
57
|
+
db.Gaia_DR3.dec,
|
58
|
+
#db.Gaia_DR3.dec_error,
|
59
|
+
db.Gaia_DR3.parallax,
|
60
|
+
#db.Gaia_DR3.parallax_error,
|
61
|
+
#db.Gaia_DR3.parallax_over_error,
|
62
|
+
#db.Gaia_DR3.pm,
|
63
|
+
#db.Gaia_DR3.pmra,
|
64
|
+
#db.Gaia_DR3.pmra_error,
|
65
|
+
#db.Gaia_DR3.pmdec,
|
66
|
+
#db.Gaia_DR3.pmdec_error,
|
67
|
+
#db.Gaia_DR3.ra_dec_corr,
|
68
|
+
#db.Gaia_DR3.ra_parallax_corr,
|
69
|
+
#db.Gaia_DR3.ra_pmra_corr,
|
70
|
+
#db.Gaia_DR3.ra_pmdec_corr,
|
71
|
+
#db.Gaia_DR3.dec_parallax_corr,
|
72
|
+
#db.Gaia_DR3.dec_pmra_corr,
|
73
|
+
#db.Gaia_DR3.dec_pmdec_corr,
|
74
|
+
#db.Gaia_DR3.parallax_pmra_corr,
|
75
|
+
#db.Gaia_DR3.parallax_pmdec_corr,
|
76
|
+
#db.Gaia_DR3.pmra_pmdec_corr,
|
77
|
+
#db.Gaia_DR3.astrometric_n_obs_al,
|
78
|
+
#db.Gaia_DR3.astrometric_n_obs_ac,
|
79
|
+
#db.Gaia_DR3.astrometric_n_good_obs_al,
|
80
|
+
#db.Gaia_DR3.astrometric_n_bad_obs_al,
|
81
|
+
#db.Gaia_DR3.astrometric_gof_al,
|
82
|
+
#db.Gaia_DR3.astrometric_chi2_al,
|
83
|
+
#db.Gaia_DR3.astrometric_excess_noise,
|
84
|
+
#db.Gaia_DR3.astrometric_excess_noise_sig,
|
85
|
+
#db.Gaia_DR3.astrometric_params_solved,
|
86
|
+
#db.Gaia_DR3.astrometric_primary_flag,
|
87
|
+
#db.Gaia_DR3.nu_eff_used_in_astrometry,
|
88
|
+
#db.Gaia_DR3.pseudocolour,
|
89
|
+
#db.Gaia_DR3.pseudocolour_error,
|
90
|
+
#db.Gaia_DR3.ra_pseudocolour_corr,
|
91
|
+
#db.Gaia_DR3.dec_pseudocolour_corr,
|
92
|
+
#db.Gaia_DR3.parallax_pseudocolour_corr,
|
93
|
+
#db.Gaia_DR3.pmra_pseudocolour_corr,
|
94
|
+
#db.Gaia_DR3.pmdec_pseudocolour_corr,
|
95
|
+
#db.Gaia_DR3.astrometric_matched_transits,
|
96
|
+
#db.Gaia_DR3.visibility_periods_used,
|
97
|
+
#db.Gaia_DR3.astrometric_sigma5d_max,
|
98
|
+
#db.Gaia_DR3.matched_transits,
|
99
|
+
#db.Gaia_DR3.new_matched_transits,
|
100
|
+
#db.Gaia_DR3.matched_transits_removed,
|
101
|
+
#db.Gaia_DR3.ipd_gof_harmonic_amplitude,
|
102
|
+
#db.Gaia_DR3.ipd_gof_harmonic_phase,
|
103
|
+
#db.Gaia_DR3.ipd_frac_multi_peak,
|
104
|
+
#db.Gaia_DR3.ipd_frac_odd_win,
|
105
|
+
#db.Gaia_DR3.ruwe,
|
106
|
+
#db.Gaia_DR3.scan_direction_strength_k1,
|
107
|
+
#db.Gaia_DR3.scan_direction_strength_k2,
|
108
|
+
#db.Gaia_DR3.scan_direction_strength_k3,
|
109
|
+
#db.Gaia_DR3.scan_direction_strength_k4,
|
110
|
+
#db.Gaia_DR3.scan_direction_mean_k1,
|
111
|
+
#db.Gaia_DR3.scan_direction_mean_k2,
|
112
|
+
#db.Gaia_DR3.scan_direction_mean_k3,
|
113
|
+
#db.Gaia_DR3.scan_direction_mean_k4,
|
114
|
+
#db.Gaia_DR3.duplicated_source,
|
115
|
+
#db.Gaia_DR3.phot_g_n_obs,
|
116
|
+
#db.Gaia_DR3.phot_g_mean_flux,
|
117
|
+
#db.Gaia_DR3.phot_g_mean_flux_error,
|
118
|
+
#db.Gaia_DR3.phot_g_mean_flux_over_error,
|
119
|
+
#db.Gaia_DR3.phot_g_mean_mag,
|
120
|
+
#db.Gaia_DR3.phot_bp_n_obs,
|
121
|
+
#db.Gaia_DR3.phot_bp_mean_flux,
|
122
|
+
#db.Gaia_DR3.phot_bp_mean_flux_error,
|
123
|
+
#db.Gaia_DR3.phot_bp_mean_flux_over_error,
|
124
|
+
#db.Gaia_DR3.phot_bp_mean_mag,
|
125
|
+
#db.Gaia_DR3.phot_rp_n_obs,
|
126
|
+
#db.Gaia_DR3.phot_rp_mean_flux,
|
127
|
+
#db.Gaia_DR3.phot_rp_mean_flux_error,
|
128
|
+
#db.Gaia_DR3.phot_rp_mean_flux_over_error,
|
129
|
+
#db.Gaia_DR3.phot_rp_mean_mag,
|
130
|
+
#db.Gaia_DR3.phot_bp_rp_excess_factor,
|
131
|
+
#db.Gaia_DR3.phot_bp_n_contaminated_transits,
|
132
|
+
#db.Gaia_DR3.phot_bp_n_blended_transits,
|
133
|
+
#db.Gaia_DR3.phot_rp_n_contaminated_transits,
|
134
|
+
#db.Gaia_DR3.phot_rp_n_blended_transits,
|
135
|
+
#db.Gaia_DR3.phot_proc_mode,
|
136
|
+
db.Gaia_DR3.bp_rp,
|
137
|
+
db.Gaia_DR3.bp_g,
|
138
|
+
db.Gaia_DR3.g_rp,
|
139
|
+
db.Gaia_DR3.radial_velocity,
|
140
|
+
db.Gaia_DR3.radial_velocity_error,
|
141
|
+
#db.Gaia_DR3.rv_method_used,
|
142
|
+
#db.Gaia_DR3.rv_nb_transits,
|
143
|
+
#db.Gaia_DR3.rv_nb_deblended_transits,
|
144
|
+
#db.Gaia_DR3.rv_visibility_periods_used,
|
145
|
+
#db.Gaia_DR3.rv_expected_sig_to_noise,
|
146
|
+
#db.Gaia_DR3.rv_renormalised_gof,
|
147
|
+
#db.Gaia_DR3.rv_chisq_pvalue,
|
148
|
+
#db.Gaia_DR3.rv_time_duration,
|
149
|
+
#db.Gaia_DR3.rv_amplitude_robust,
|
150
|
+
#db.Gaia_DR3.rv_template_teff,
|
151
|
+
#db.Gaia_DR3.rv_template_logg,
|
152
|
+
#db.Gaia_DR3.rv_template_fe_h,
|
153
|
+
#db.Gaia_DR3.rv_atm_param_origin,
|
154
|
+
#db.Gaia_DR3.vbroad,
|
155
|
+
#db.Gaia_DR3.vbroad_error,
|
156
|
+
#db.Gaia_DR3.vbroad_nb_transits,
|
157
|
+
#db.Gaia_DR3.grvs_mag,
|
158
|
+
#db.Gaia_DR3.grvs_mag_error,
|
159
|
+
#db.Gaia_DR3.grvs_mag_nb_transits,
|
160
|
+
#db.Gaia_DR3.rvs_spec_sig_to_noise,
|
161
|
+
#db.Gaia_DR3.phot_variable_flag,
|
162
|
+
#db.Gaia_DR3.l,
|
163
|
+
#db.Gaia_DR3.b,
|
164
|
+
#db.Gaia_DR3.ecl_lon,
|
165
|
+
#db.Gaia_DR3.ecl_lat,
|
166
|
+
#db.Gaia_DR3.in_qso_candidates,
|
167
|
+
#db.Gaia_DR3.in_galaxy_candidates,
|
168
|
+
#db.Gaia_DR3.non_single_star,
|
169
|
+
#db.Gaia_DR3.has_xp_continuous,
|
170
|
+
#db.Gaia_DR3.has_xp_sampled,
|
171
|
+
#db.Gaia_DR3.has_rvs,
|
172
|
+
#db.Gaia_DR3.has_epoch_photometry,
|
173
|
+
#db.Gaia_DR3.has_epoch_rv,
|
174
|
+
#db.Gaia_DR3.has_mcmc_gspphot,
|
175
|
+
#db.Gaia_DR3.has_mcmc_msc,
|
176
|
+
#db.Gaia_DR3.in_andromeda_survey,
|
177
|
+
#db.Gaia_DR3.classprob_dsc_combmod_quasar,
|
178
|
+
#db.Gaia_DR3.classprob_dsc_combmod_galaxy,
|
179
|
+
#db.Gaia_DR3.classprob_dsc_combmod_star,
|
180
|
+
#db.Gaia_DR3.teff_gspphot,
|
181
|
+
#db.Gaia_DR3.teff_gspphot_lower,
|
182
|
+
#db.Gaia_DR3.teff_gspphot_upper,
|
183
|
+
#db.Gaia_DR3.logg_gspphot,
|
184
|
+
#db.Gaia_DR3.logg_gspphot_lower,
|
185
|
+
#db.Gaia_DR3.logg_gspphot_upper,
|
186
|
+
#db.Gaia_DR3.mh_gspphot,
|
187
|
+
#db.Gaia_DR3.mh_gspphot_lower,
|
188
|
+
#db.Gaia_DR3.mh_gspphot_upper,
|
189
|
+
#db.Gaia_DR3.distance_gspphot,
|
190
|
+
#db.Gaia_DR3.distance_gspphot_lower,
|
191
|
+
#db.Gaia_DR3.distance_gspphot_upper,
|
192
|
+
#db.Gaia_DR3.azero_gspphot,
|
193
|
+
#db.Gaia_DR3.azero_gspphot_lower,
|
194
|
+
#db.Gaia_DR3.azero_gspphot_upper,
|
195
|
+
#db.Gaia_DR3.ag_gspphot,
|
196
|
+
#db.Gaia_DR3.ag_gspphot_lower,
|
197
|
+
#db.Gaia_DR3.ag_gspphot_upper,
|
198
|
+
#db.Gaia_DR3.ebpminrp_gspphot,
|
199
|
+
#db.Gaia_DR3.ebpminrp_gspphot_lower,
|
200
|
+
#db.Gaia_DR3.ebpminrp_gspphot_upper,
|
201
|
+
#db.Gaia_DR3.libname_gspphot,
|
202
|
+
db.TwoMassPSC.designation,
|
203
|
+
db.TwoMassPSC.j_m,
|
204
|
+
#db.TwoMassPSC.j_cmsig,
|
205
|
+
#db.TwoMassPSC.j_msigcom,
|
206
|
+
#db.TwoMassPSC.j_snr,
|
207
|
+
db.TwoMassPSC.h_m,
|
208
|
+
#db.TwoMassPSC.h_cmsig,
|
209
|
+
#db.TwoMassPSC.h_msigcom,
|
210
|
+
#db.TwoMassPSC.h_snr,
|
211
|
+
db.TwoMassPSC.k_m,
|
212
|
+
#db.TwoMassPSC.k_cmsig,
|
213
|
+
#db.TwoMassPSC.k_msigcom,
|
214
|
+
#db.TwoMassPSC.k_snr,
|
215
|
+
#db.TwoMassPSC.ph_qual,
|
216
|
+
#db.TwoMassPSC.rd_flg,
|
217
|
+
#db.TwoMassPSC.bl_flg,
|
218
|
+
#db.TwoMassPSC.cc_flg,
|
219
|
+
#db.TwoMassPSC.ndet,
|
220
|
+
#db.TwoMassPSC.prox,
|
221
|
+
#db.TwoMassPSC.pxpa,
|
222
|
+
#db.TwoMassPSC.pxcntr,
|
223
|
+
#db.TwoMassPSC.gal_contam,
|
224
|
+
#db.TwoMassPSC.mp_flg,
|
225
|
+
#db.TwoMassPSC.scan,
|
226
|
+
#db.TwoMassPSC.glon,
|
227
|
+
#db.TwoMassPSC.glat,
|
228
|
+
#db.TwoMassPSC.x_scan,
|
229
|
+
#db.TwoMassPSC.jdate,
|
230
|
+
#db.TwoMassPSC.j_psfchi,
|
231
|
+
#db.TwoMassPSC.h_psfchi,
|
232
|
+
#db.TwoMassPSC.k_psfchi,
|
233
|
+
#db.TwoMassPSC.j_m_stdap,
|
234
|
+
#db.TwoMassPSC.j_msig_stdap,
|
235
|
+
#db.TwoMassPSC.h_m_stdap,
|
236
|
+
#db.TwoMassPSC.h_msig_stdap,
|
237
|
+
#db.TwoMassPSC.k_m_stdap,
|
238
|
+
#db.TwoMassPSC.k_msig_stdap,
|
239
|
+
#db.TwoMassPSC.dist_edge_ns,
|
240
|
+
#db.TwoMassPSC.dist_edge_ew,
|
241
|
+
#db.TwoMassPSC.dist_edge_flg,
|
242
|
+
#db.TwoMassPSC.dup_src,
|
243
|
+
#db.TwoMassPSC.use_src,
|
244
|
+
#db.TwoMassPSC.a,
|
245
|
+
#db.TwoMassPSC.dist_opt,
|
246
|
+
#db.TwoMassPSC.phi_opt,
|
247
|
+
#db.TwoMassPSC.b_m_opt,
|
248
|
+
#db.TwoMassPSC.vr_m_opt,
|
249
|
+
#db.TwoMassPSC.nopt_mchs,
|
250
|
+
#db.TwoMassPSC.ext_key,
|
251
|
+
#db.TwoMassPSC.scan_key,
|
252
|
+
#db.TwoMassPSC.coadd_key,
|
253
|
+
#db.TwoMassPSC.coadd
|
254
|
+
)
|
255
|
+
.distinct(db.SDSS_ID_To_Catalog.sdss_id)
|
256
|
+
.join(db.Gaia_DR3, join_type=JOIN.LEFT_OUTER)
|
257
|
+
.switch(db.SDSS_ID_To_Catalog)
|
258
|
+
.join(db.TwoMassPSC, join_type=JOIN.LEFT_OUTER)
|
259
|
+
.where(db.SDSS_ID_To_Catalog.sdss_id.in_(tuple(batch)))
|
260
|
+
.dicts()
|
261
|
+
)
|
262
|
+
yield from q.iterator()
|
@@ -41,7 +41,7 @@ def main(
|
|
41
41
|
|
42
42
|
# This keeps the default behaviour as 'query mode' but allows for commands like 'config'.
|
43
43
|
if ctx.invoked_subcommand is not None:
|
44
|
-
command = dict(config=config, dump=dump)[ctx.invoked_subcommand]
|
44
|
+
command = dict(config=config, dump=dump, add=add)[ctx.invoked_subcommand]
|
45
45
|
return ctx.invoke(command, **ctx.params)
|
46
46
|
|
47
47
|
import h5py as h5
|
@@ -196,6 +196,94 @@ def main(
|
|
196
196
|
for item in buffered_critical_logs:
|
197
197
|
logger.critical(item)
|
198
198
|
|
199
|
+
@main.group()
|
200
|
+
def add(**kwargs):
|
201
|
+
"""Add new information to an existing Almanac file."""
|
202
|
+
pass
|
203
|
+
|
204
|
+
@add.command()
|
205
|
+
@click.argument("input_path", type=str)
|
206
|
+
@click.option("--mjd", default=None, type=int, help="Modified Julian Date")
|
207
|
+
@click.option("--apo", is_flag=True, help="Apache Point Observatory")
|
208
|
+
@click.option("--lco", is_flag=True, help="Las Campanas Observatory")
|
209
|
+
def metadata(input_path, mjd, apo, lco, **kwargs):
|
210
|
+
"""Add photometry and astrometry to an existing Almanac file."""
|
211
|
+
|
212
|
+
import numpy as np
|
213
|
+
from almanac import utils
|
214
|
+
from almanac.catalog import query_catalog
|
215
|
+
|
216
|
+
observatories = utils.get_observatories(apo, lco)
|
217
|
+
|
218
|
+
# Open the input file and get all possible sdss_ids
|
219
|
+
import h5py as h5
|
220
|
+
from tqdm import tqdm
|
221
|
+
with h5.File(input_path, "r+") as fp:
|
222
|
+
sdss_ids = dict()
|
223
|
+
|
224
|
+
if mjd is None:
|
225
|
+
total = sum([len(fp[obs].keys()) for obs in observatories])
|
226
|
+
else:
|
227
|
+
total = 1 * len(observatories)
|
228
|
+
|
229
|
+
with tqdm(total=total, desc="Collecting SDSS identifiers") as pb:
|
230
|
+
for observatory in observatories:
|
231
|
+
if observatory not in fp:
|
232
|
+
continue
|
233
|
+
|
234
|
+
mjds = fp[observatory].keys() if mjd is None else [str(mjd)]
|
235
|
+
|
236
|
+
for mjd in mjds:
|
237
|
+
if mjd not in fp[observatory]:
|
238
|
+
continue
|
239
|
+
group = fp[f"{observatory}/{mjd}"]
|
240
|
+
if "fibers" not in group:
|
241
|
+
continue
|
242
|
+
for config_id in group["fibers"]:
|
243
|
+
config_group = group[f"fibers/{config_id}"]
|
244
|
+
|
245
|
+
if "source_id" in config_group:
|
246
|
+
continue
|
247
|
+
|
248
|
+
dtypes = dict(
|
249
|
+
sdss_id=(np.int64, -1),
|
250
|
+
source_id=(np.int64, -1),
|
251
|
+
ra=(float, np.nan),
|
252
|
+
dec=(float, np.nan),
|
253
|
+
parallax=(float, np.nan),
|
254
|
+
radial_velocity=(float, np.nan),
|
255
|
+
radial_velocity_error=(float, np.nan),
|
256
|
+
bp_rp=(float, np.nan),
|
257
|
+
bp_g=(float, np.nan),
|
258
|
+
g_rp=(float, np.nan),
|
259
|
+
designation=(None, ""),
|
260
|
+
j_m=(float, np.nan),
|
261
|
+
h_m=(float, np.nan),
|
262
|
+
k_m=(float, np.nan),
|
263
|
+
)
|
264
|
+
|
265
|
+
n = len(config_group["sdss_id"][:])
|
266
|
+
metadata = {k: [v[1]] * n for k, v in dtypes.items()}
|
267
|
+
for i, row in enumerate(query_catalog(list(config_group["sdss_id"][:]))):
|
268
|
+
for key in row.keys():
|
269
|
+
metadata[key][i] = row[key]
|
270
|
+
|
271
|
+
# match to existing sdss_id
|
272
|
+
new_id = np.argsort(np.argsort(config_group["sdss_id"][:]))
|
273
|
+
indices = np.argsort(metadata["sdss_id"])[new_id]
|
274
|
+
|
275
|
+
for key, values in metadata.items():
|
276
|
+
if key in config_group:
|
277
|
+
continue
|
278
|
+
dtype, default = dtypes[key]
|
279
|
+
values = np.array([v or default for v in values], dtype=dtype)[indices]
|
280
|
+
if key == "designation":
|
281
|
+
values = list(map(str, values))
|
282
|
+
config_group.create_dataset(key, data=values, dtype=dtype)
|
283
|
+
print(f"Created {observatory}/{mjd}/fibers/{config_id}/{key}")
|
284
|
+
pb.update(1)
|
285
|
+
|
286
|
+
|
199
287
|
@main.group()
|
200
288
|
def config(**kwargs):
|
201
289
|
"""View or update configuration settings."""
|
@@ -259,11 +347,19 @@ def get(key, **kwargs):
|
|
259
347
|
click.echo(value)
|
260
348
|
|
261
349
|
|
262
|
-
@config.command
|
350
|
+
@config.command(hidden=True)
|
263
351
|
@click.argument("key")
|
264
352
|
@click.argument("value")
|
265
353
|
def update(key, value, **kwargs):
|
266
354
|
"""Update a configuration value"""
|
355
|
+
click.echo(click.style("Deprecated: use `almanac config set`", fg="yellow"))
|
356
|
+
return set(key, value, **kwargs)
|
357
|
+
|
358
|
+
@config.command
|
359
|
+
@click.argument("key")
|
360
|
+
@click.argument("value")
|
361
|
+
def set(key, value, **kwargs):
|
362
|
+
"""Set a configuration value"""
|
267
363
|
|
268
364
|
from almanac import config, get_config_path, ConfigManager
|
269
365
|
from dataclasses import asdict, is_dataclass
|
@@ -79,7 +79,13 @@ class Exposure(BaseModel):
|
|
79
79
|
|
80
80
|
@computed_field
|
81
81
|
def flagged_bad(self) -> bool:
|
82
|
-
|
82
|
+
marked_bad = (self.observatory, self.mjd, self.exposure) in lookup_bad_exposures
|
83
|
+
missing_plate_info = (
|
84
|
+
(self.image_type == "object")
|
85
|
+
& ((self.fps and self.config_id <= 0) or (not self.fps and self.plate_id <= 0))
|
86
|
+
)
|
87
|
+
return marked_bad or missing_plate_info
|
88
|
+
|
83
89
|
|
84
90
|
@computed_field
|
85
91
|
def chip_flags(self) -> int:
|
@@ -317,7 +323,7 @@ class Exposure(BaseModel):
|
|
317
323
|
"fiberId": fiber_id,
|
318
324
|
"racat": np.nan,
|
319
325
|
"deccat": np.nan,
|
320
|
-
"category": "
|
326
|
+
"category": "bonus",
|
321
327
|
})
|
322
328
|
rows.sort("fiberId")
|
323
329
|
else:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|