added csv pull
Browse files- utils/eval_baselines.py +17 -17
- utils/pull_jwst_csv.py +280 -0
utils/eval_baselines.py
CHANGED
|
@@ -79,11 +79,11 @@ def main(dim):
|
|
| 79 |
for path in tqdm(file_paths):
|
| 80 |
with fits.open(path) as hdul:
|
| 81 |
if dim == '2d':
|
| 82 |
-
|
| 83 |
elif dim == '2d_diffs' and len(hdul[1].data[0]) > 1:
|
| 84 |
-
|
| 85 |
elif dim == '3dt' and len(hdul[1].data[0]) > 2:
|
| 86 |
-
|
| 87 |
else:
|
| 88 |
continue
|
| 89 |
|
|
@@ -91,21 +91,21 @@ def main(dim):
|
|
| 91 |
if ct % 10 == 0:
|
| 92 |
print(df.mean())
|
| 93 |
df.to_csv(save_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
for algo in ALL_CODECS.keys():
|
| 96 |
-
try:
|
| 97 |
-
if algo == "JPEG_2K" and dim == '3dt':
|
| 98 |
-
test_results = benchmark_imagecodecs_compression_algos(arr.transpose(1, 2, 0), algo)
|
| 99 |
-
else:
|
| 100 |
-
test_results = benchmark_imagecodecs_compression_algos(arr, algo)
|
| 101 |
-
|
| 102 |
-
for column, value in test_results.items():
|
| 103 |
-
if column in df.columns:
|
| 104 |
-
df.at[path, column] = value
|
| 105 |
-
|
| 106 |
-
except Exception as e:
|
| 107 |
-
print(f"Failed at {path} under exception {e}.")
|
| 108 |
-
|
| 109 |
|
| 110 |
if __name__ == "__main__":
|
| 111 |
parser = argparse.ArgumentParser(description="Process some 2D or 3D data.")
|
|
|
|
| 79 |
for path in tqdm(file_paths):
|
| 80 |
with fits.open(path) as hdul:
|
| 81 |
if dim == '2d':
|
| 82 |
+
arrs = [hdul[1].data[0][0]]
|
| 83 |
elif dim == '2d_diffs' and len(hdul[1].data[0]) > 1:
|
| 84 |
+
arrs = [hdul[1].data[0][i + 1] - hdul[1].data[0][i] for i in range(len(hdul[1].data[0]) - 1)]
|
| 85 |
elif dim == '3dt' and len(hdul[1].data[0]) > 2:
|
| 86 |
+
arrs = [hdul[1].data[0][0:3]]
|
| 87 |
else:
|
| 88 |
continue
|
| 89 |
|
|
|
|
| 91 |
if ct % 10 == 0:
|
| 92 |
print(df.mean())
|
| 93 |
df.to_csv(save_path)
|
| 94 |
+
for group, arr in enumerate(arrs):
|
| 95 |
+
for algo in ALL_CODECS.keys():
|
| 96 |
+
try:
|
| 97 |
+
if algo == "JPEG_2K" and dim == '3dt':
|
| 98 |
+
test_results = benchmark_imagecodecs_compression_algos(arr.transpose(1, 2, 0), algo)
|
| 99 |
+
else:
|
| 100 |
+
test_results = benchmark_imagecodecs_compression_algos(arr, algo)
|
| 101 |
+
|
| 102 |
+
for column, value in test_results.items():
|
| 103 |
+
if column in df.columns:
|
| 104 |
+
df.at[path + f"_{group}", column] = value
|
| 105 |
+
|
| 106 |
+
except Exception as e:
|
| 107 |
+
print(f"Failed at {path} under exception {e}.")
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
if __name__ == "__main__":
|
| 111 |
parser = argparse.ArgumentParser(description="Process some 2D or 3D data.")
|
utils/pull_jwst_csv.py
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from astroquery.mast.missions import MastMissions
|
| 2 |
+
|
| 3 |
+
missions = MastMissions(mission='jwst')
|
| 4 |
+
|
| 5 |
+
"""
|
| 6 |
+
Used to pull the list of observations that fit our filter criteria from
|
| 7 |
+
online JWST archives. See all filter details in the function call below.
|
| 8 |
+
|
| 9 |
+
If your API query here times out, you may have to manually search into the UI here, and download as CSV:
|
| 10 |
+
https://mast.stsci.edu/search/ui
|
| 11 |
+
|
| 12 |
+
Use the parameters outlined below when searching.
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
# Use query_criteria method to use selected form search conditions for making missions_mast search API call
|
| 16 |
+
results = missions.query_criteria(select_cols=[
|
| 17 |
+
'act_id',
|
| 18 |
+
'targname',
|
| 19 |
+
'ang_sep',
|
| 20 |
+
'apername',
|
| 21 |
+
'intarget',
|
| 22 |
+
'bkgmeth',
|
| 23 |
+
'bkgdtarg',
|
| 24 |
+
'bartdelt',
|
| 25 |
+
'cal_vcs',
|
| 26 |
+
'cal_ver',
|
| 27 |
+
'bkglevel',
|
| 28 |
+
'bkgsub',
|
| 29 |
+
'miri_cccstate',
|
| 30 |
+
'cont_id',
|
| 31 |
+
'crds_ver',
|
| 32 |
+
'crds_ctx',
|
| 33 |
+
'fileSetName',
|
| 34 |
+
'date_end',
|
| 35 |
+
'date_beg',
|
| 36 |
+
'targ_dec',
|
| 37 |
+
'miri_detmode',
|
| 38 |
+
'miri_ditchdirc',
|
| 39 |
+
'miri_dithopfr',
|
| 40 |
+
'pixfrac',
|
| 41 |
+
'effexptm',
|
| 42 |
+
'effexptm',
|
| 43 |
+
'effinttm',
|
| 44 |
+
'intend',
|
| 45 |
+
'eng_qual',
|
| 46 |
+
'errtype',
|
| 47 |
+
'duration',
|
| 48 |
+
'exp_type',
|
| 49 |
+
'expend',
|
| 50 |
+
'is_psf',
|
| 51 |
+
'expmid',
|
| 52 |
+
'exposure',
|
| 53 |
+
'expstart',
|
| 54 |
+
'fastaxis',
|
| 55 |
+
'fgs_focuspos',
|
| 56 |
+
'filter',
|
| 57 |
+
'gainfact',
|
| 58 |
+
'nirspec_gwa_ytilt',
|
| 59 |
+
'nirspec_gwa_xtilt',
|
| 60 |
+
'gs_dec',
|
| 61 |
+
'gs_udec',
|
| 62 |
+
'gdstarid',
|
| 63 |
+
'gs_order',
|
| 64 |
+
'gs_mag',
|
| 65 |
+
'gs_umag',
|
| 66 |
+
'gs_dra',
|
| 67 |
+
'gs_ura',
|
| 68 |
+
'gsendtim',
|
| 69 |
+
'gsstrttm',
|
| 70 |
+
'nirspec_gwa_pxav',
|
| 71 |
+
'nirspec_gwa_pyav',
|
| 72 |
+
'nirspec_gwa_tilt',
|
| 73 |
+
'nirspec_gwa_xp_v',
|
| 74 |
+
'nirspec_gwa_yp_v',
|
| 75 |
+
'helidelt',
|
| 76 |
+
'hendtime',
|
| 77 |
+
'hmidtime',
|
| 78 |
+
'hstrtime',
|
| 79 |
+
'hga_move',
|
| 80 |
+
'origin',
|
| 81 |
+
'instrume',
|
| 82 |
+
'lamp',
|
| 83 |
+
'opmode',
|
| 84 |
+
'masterbg',
|
| 85 |
+
'miri_coronmsk',
|
| 86 |
+
'miri_mirnfrms',
|
| 87 |
+
'miri_mirngrps',
|
| 88 |
+
'miri_channel',
|
| 89 |
+
'miri_pattnpts',
|
| 90 |
+
'miri_spat_num',
|
| 91 |
+
'miri_spec_num',
|
| 92 |
+
'miri_band',
|
| 93 |
+
'nirspec_msaconid',
|
| 94 |
+
'nirspec_msametfl',
|
| 95 |
+
'nirspec_msametid',
|
| 96 |
+
'detector',
|
| 97 |
+
'nirspec_fxd_slit',
|
| 98 |
+
'nircam_smgrdpat',
|
| 99 |
+
'obsfolder',
|
| 100 |
+
'asntable',
|
| 101 |
+
'asnpool',
|
| 102 |
+
'nirspec_grating',
|
| 103 |
+
'nircam_pupil',
|
| 104 |
+
'nwfsest',
|
| 105 |
+
'nircam_channel',
|
| 106 |
+
'nircam_coronmsk',
|
| 107 |
+
'nircam_module',
|
| 108 |
+
'niriss_fwcpos',
|
| 109 |
+
'niriss_focuspos',
|
| 110 |
+
'niriss_pupil',
|
| 111 |
+
'niriss_pwcpos',
|
| 112 |
+
'nirspec_focuspos',
|
| 113 |
+
'nirspec_is_imprt',
|
| 114 |
+
'nirspec_spat_num',
|
| 115 |
+
'nirspec_spec_num',
|
| 116 |
+
'nirspec_nod_type',
|
| 117 |
+
'miri_numdsets',
|
| 118 |
+
'nsamples',
|
| 119 |
+
'noutputs',
|
| 120 |
+
'nextend',
|
| 121 |
+
'groupgap',
|
| 122 |
+
'drpfrms3',
|
| 123 |
+
'drpfrms1',
|
| 124 |
+
'nframes',
|
| 125 |
+
'ngroups',
|
| 126 |
+
'nints',
|
| 127 |
+
'nirspec_nrs_norm',
|
| 128 |
+
'subsize1',
|
| 129 |
+
'subsize2',
|
| 130 |
+
'niriss_nrimdtpt',
|
| 131 |
+
'pridtpts',
|
| 132 |
+
'subpxpts',
|
| 133 |
+
'nirspec_nrs_ref',
|
| 134 |
+
'nrststrt',
|
| 135 |
+
'nresets',
|
| 136 |
+
'miri_spatnstp',
|
| 137 |
+
'miri_specnstp',
|
| 138 |
+
'obslabel',
|
| 139 |
+
'observtn',
|
| 140 |
+
'oss_ver',
|
| 141 |
+
'osf_file',
|
| 142 |
+
'visitend',
|
| 143 |
+
'opticalElements',
|
| 144 |
+
'miri_mrsprchn',
|
| 145 |
+
'pps_aper',
|
| 146 |
+
'seq_id',
|
| 147 |
+
'pi_name',
|
| 148 |
+
'pxsclrt',
|
| 149 |
+
'miri_dithpnts',
|
| 150 |
+
'nirspec_dithpnts',
|
| 151 |
+
'pcs_mode',
|
| 152 |
+
'nircam_fam_la1',
|
| 153 |
+
'nircam_fam_la2',
|
| 154 |
+
'nircam_fam_la3',
|
| 155 |
+
'patt_num',
|
| 156 |
+
'datamode',
|
| 157 |
+
'nirspec_preimage',
|
| 158 |
+
'pwfseet',
|
| 159 |
+
'pattsize',
|
| 160 |
+
'patttype',
|
| 161 |
+
'nircam_pridtype',
|
| 162 |
+
'expripar',
|
| 163 |
+
'timesys',
|
| 164 |
+
'productLevel',
|
| 165 |
+
'program',
|
| 166 |
+
'category',
|
| 167 |
+
'subcat',
|
| 168 |
+
'proposal_type',
|
| 169 |
+
'obs_id',
|
| 170 |
+
'proposal_cycle',
|
| 171 |
+
'title',
|
| 172 |
+
'prop_dec',
|
| 173 |
+
'prop_ra',
|
| 174 |
+
'nircam_pilin',
|
| 175 |
+
'targ_ra',
|
| 176 |
+
'readpatt',
|
| 177 |
+
'nirspec_rma_pos',
|
| 178 |
+
'nirspec_fcsrlpos',
|
| 179 |
+
'publicReleaseDate',
|
| 180 |
+
'nircam_fa1value',
|
| 181 |
+
'nircam_faphase1',
|
| 182 |
+
'nircam_fastep1',
|
| 183 |
+
'nircam_faunit1',
|
| 184 |
+
'nircam_fa2value',
|
| 185 |
+
'nircam_faphase2',
|
| 186 |
+
'nircam_fastep2',
|
| 187 |
+
'nircam_faunit2',
|
| 188 |
+
'nircam_fa3value',
|
| 189 |
+
'nircam_faphase3',
|
| 190 |
+
'nircam_fastep3',
|
| 191 |
+
'nircam_faunit3',
|
| 192 |
+
'expcount',
|
| 193 |
+
'prd_ver',
|
| 194 |
+
'scicat',
|
| 195 |
+
'dataprob',
|
| 196 |
+
'segmfile',
|
| 197 |
+
'selfref',
|
| 198 |
+
'sca_num',
|
| 199 |
+
'exsegnum',
|
| 200 |
+
'rois',
|
| 201 |
+
'roiw',
|
| 202 |
+
'miri_spatstep',
|
| 203 |
+
'miri_specstep',
|
| 204 |
+
'slowaxis',
|
| 205 |
+
'scatfile',
|
| 206 |
+
'engqlptg',
|
| 207 |
+
'sctarate',
|
| 208 |
+
'miri_sptoffst',
|
| 209 |
+
'exp_only',
|
| 210 |
+
'miri_spcoffst',
|
| 211 |
+
'date_obs',
|
| 212 |
+
'miri_dsetstrt',
|
| 213 |
+
'intstart',
|
| 214 |
+
'substrt1',
|
| 215 |
+
'substrt2',
|
| 216 |
+
'miri_pattstrt',
|
| 217 |
+
'nirspec_pattstrt',
|
| 218 |
+
'nirspec_msastate',
|
| 219 |
+
'access',
|
| 220 |
+
'visitsta',
|
| 221 |
+
'subarray',
|
| 222 |
+
'nircam_subpxpat',
|
| 223 |
+
'nirspec_subpxpat',
|
| 224 |
+
'targcat',
|
| 225 |
+
'targudec',
|
| 226 |
+
'targdesc',
|
| 227 |
+
'targprop',
|
| 228 |
+
'mu_epoch',
|
| 229 |
+
'mu_dec',
|
| 230 |
+
'mu_ra',
|
| 231 |
+
'targura',
|
| 232 |
+
'targtype',
|
| 233 |
+
'bstrtime',
|
| 234 |
+
'bendtime',
|
| 235 |
+
'bmidtime',
|
| 236 |
+
'telescop',
|
| 237 |
+
'template',
|
| 238 |
+
'miri_cmd_tsel',
|
| 239 |
+
'tframe',
|
| 240 |
+
'tgroup',
|
| 241 |
+
'tsample',
|
| 242 |
+
'tsovisit',
|
| 243 |
+
'texptime',
|
| 244 |
+
'texptime',
|
| 245 |
+
'nexposur',
|
| 246 |
+
'numdthpt',
|
| 247 |
+
'exsegtot',
|
| 248 |
+
'tcatfile',
|
| 249 |
+
'datamodl',
|
| 250 |
+
'date',
|
| 251 |
+
'expsteng',
|
| 252 |
+
'gsendtim',
|
| 253 |
+
'gsstrttm',
|
| 254 |
+
'vststart',
|
| 255 |
+
'gs_v3_pa',
|
| 256 |
+
'frmdivsr',
|
| 257 |
+
'va_dec',
|
| 258 |
+
'va_ra',
|
| 259 |
+
'visitgrp',
|
| 260 |
+
'visid_id',
|
| 261 |
+
'visit',
|
| 262 |
+
'targoopp',
|
| 263 |
+
'visitype',
|
| 264 |
+
'wpower',
|
| 265 |
+
'wtype',
|
| 266 |
+
'dirimage',
|
| 267 |
+
'xoffset',
|
| 268 |
+
'yoffset',
|
| 269 |
+
'zerofram'], exp_type='NRC_IMAGE',
|
| 270 |
+
instrume='NIRCAM',
|
| 271 |
+
opticalElements='*F200W;CLEAR*',
|
| 272 |
+
productLevel='*1b*',
|
| 273 |
+
targtype='FIXED',
|
| 274 |
+
visitsta='SUCCESSFUL',
|
| 275 |
+
access='PUBLIC',
|
| 276 |
+
effinttm='>30')
|
| 277 |
+
|
| 278 |
+
df = results.to_pandas()
|
| 279 |
+
print(len(df))
|
| 280 |
+
df.to_csv('jwst_FINAL.csv')
|