stdpipe 0.2.2__tar.gz → 0.2.4__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.
- stdpipe-0.2.4/PKG-INFO +29 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/setup.py +1 -1
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/catalogs.py +156 -68
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/cutouts.py +22 -47
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/lcs.py +3 -3
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/photometry.py +131 -45
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/pipeline.py +24 -8
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/plots.py +56 -17
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/resolve.py +1 -1
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/subtraction.py +2 -2
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/utils.py +20 -2
- stdpipe-0.2.4/stdpipe.egg-info/PKG-INFO +29 -0
- stdpipe-0.2.2/PKG-INFO +0 -13
- stdpipe-0.2.2/stdpipe.egg-info/PKG-INFO +0 -13
- {stdpipe-0.2.2 → stdpipe-0.2.4}/.gitignore +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/LICENSE.md +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/MANIFEST.in +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/README.md +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/setup.cfg +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/__init__.py +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/astrometry.py +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/data/legacysurvey.py +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/data/legacysurvey_bricks.fits.gz +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/data/ps1skycells.txt +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/data/ps1skycells.txt.orig +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/db.py +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/flycheck_catalogs.py +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/psf.py +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe/templates.py +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe.egg-info/SOURCES.txt +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe.egg-info/dependency_links.txt +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe.egg-info/requires.txt +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/stdpipe.egg-info/top_level.txt +0 -0
- {stdpipe-0.2.2 → stdpipe-0.2.4}/tests/test_dependencies.py +0 -0
stdpipe-0.2.4/PKG-INFO
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stdpipe
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: Simple Transient Detection Pipeline
|
|
5
|
+
Home-page: https://github.com/karpov-sv/stdpipe
|
|
6
|
+
Author: Sergey Karpov
|
|
7
|
+
Author-email: karpov.sv@gmail.com
|
|
8
|
+
License-File: LICENSE.md
|
|
9
|
+
Requires-Dist: numpy
|
|
10
|
+
Requires-Dist: scipy
|
|
11
|
+
Requires-Dist: astropy>=4.1
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
Requires-Dist: astroquery>0.4.1
|
|
14
|
+
Requires-Dist: sep
|
|
15
|
+
Requires-Dist: astroscrappy
|
|
16
|
+
Requires-Dist: photutils
|
|
17
|
+
Requires-Dist: statsmodels
|
|
18
|
+
Requires-Dist: tqdm
|
|
19
|
+
Requires-Dist: regions
|
|
20
|
+
Requires-Dist: python-dateutil
|
|
21
|
+
Requires-Dist: requests
|
|
22
|
+
Requires-Dist: sip_tpv
|
|
23
|
+
Requires-Dist: pyfftw
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: author-email
|
|
26
|
+
Dynamic: home-page
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
Dynamic: requires-dist
|
|
29
|
+
Dynamic: summary
|
|
@@ -30,8 +30,8 @@ catalogs = {
|
|
|
30
30
|
'usnob1': {'vizier': 'I/284/out', 'name': 'USNO-B1'},
|
|
31
31
|
'gsc': {'vizier': 'I/271/out', 'name': 'GSC 2.2'},
|
|
32
32
|
'skymapper': {
|
|
33
|
-
'vizier': 'II/
|
|
34
|
-
'name': 'SkyMapper
|
|
33
|
+
'vizier': 'II/379/smssdr4',
|
|
34
|
+
'name': 'SkyMapper DR4',
|
|
35
35
|
'extra': [
|
|
36
36
|
'_RAJ2000',
|
|
37
37
|
'_DEJ2000',
|
|
@@ -46,8 +46,8 @@ catalogs = {
|
|
|
46
46
|
'vsx': {'vizier': 'B/vsx/vsx', 'name': 'AAVSO VSX'},
|
|
47
47
|
'apass': {'vizier': 'II/336/apass9', 'name': 'APASS DR9'},
|
|
48
48
|
'sdss': {
|
|
49
|
-
'vizier': 'V/
|
|
50
|
-
'name': 'SDSS
|
|
49
|
+
'vizier': 'V/154/sdss16',
|
|
50
|
+
'name': 'SDSS DR16',
|
|
51
51
|
'extra': ['_RAJ2000', '_DEJ2000'],
|
|
52
52
|
},
|
|
53
53
|
'atlas': {
|
|
@@ -82,7 +82,7 @@ def get_cat_vizier(
|
|
|
82
82
|
- skymapper - SkyMapper DR1.1
|
|
83
83
|
- vsx - AAVSO Variable Stars Index
|
|
84
84
|
- apass - AAVSO APASS DR9
|
|
85
|
-
- sdss - SDSS
|
|
85
|
+
- sdss - SDSS DR16
|
|
86
86
|
- atlas - ATLAS-RefCat2, compilative all-sky reference catalogue with uniform zero-points in Pan-STARRS-like bands. We augment it with Johnson-Cousins B, V, R and I magnitudes the same way as Pan-STARRS.
|
|
87
87
|
- usnob1 - USNO-B1
|
|
88
88
|
- gsc - Guide Star Catalogue 2.2
|
|
@@ -218,17 +218,16 @@ def get_cat_vizier(
|
|
|
218
218
|
)
|
|
219
219
|
pI1, pI2 = (
|
|
220
220
|
[
|
|
221
|
-
-0.
|
|
222
|
-
0.
|
|
223
|
-
-0.
|
|
224
|
-
-0.
|
|
221
|
+
-0.02239162647929074,
|
|
222
|
+
0.04401240100377888,
|
|
223
|
+
-0.038500349283596795,
|
|
224
|
+
-0.19509051168348646
|
|
225
225
|
],
|
|
226
226
|
[
|
|
227
|
-
0.
|
|
228
|
-
-0.
|
|
229
|
-
-
|
|
230
|
-
-0.
|
|
231
|
-
],
|
|
227
|
+
0.014586929059030904,
|
|
228
|
+
-0.025228407778416825,
|
|
229
|
+
-0.21476143248697746,
|
|
230
|
+
-0.19509051168348637]
|
|
232
231
|
)
|
|
233
232
|
|
|
234
233
|
cat['Bmag'] = (
|
|
@@ -249,7 +248,7 @@ def get_cat_vizier(
|
|
|
249
248
|
cat['Imag'] = (
|
|
250
249
|
cat['imag']
|
|
251
250
|
+ np.polyval(pI1, cat['gmag'] - cat['rmag'])
|
|
252
|
-
+ np.polyval(pI2, cat['
|
|
251
|
+
+ np.polyval(pI2, cat['rmag'] - cat['imag'])
|
|
253
252
|
)
|
|
254
253
|
|
|
255
254
|
cat['e_Bmag'] = cat['e_gmag']
|
|
@@ -385,90 +384,169 @@ def get_cat_vizier(
|
|
|
385
384
|
cat['i_SDSS'] = g - (-0.29676 + 0.64728 * bp_rp - 0.10141 * bp_rp ** 2)
|
|
386
385
|
|
|
387
386
|
elif catalog == 'skymapper':
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
387
|
+
log("Augmenting the catalogue with Pan-STARRS photometry")
|
|
388
|
+
|
|
389
|
+
# SkyMapper DR4 to PS1 griz, my fit based on Pancino et al. (2022)
|
|
390
|
+
pg1,pg2 = (
|
|
391
|
+
[
|
|
392
|
+
-0.07715320986152466,
|
|
393
|
+
0.2694597282089696,
|
|
394
|
+
0.04069379065128178,
|
|
395
|
+
0.01396290714542747
|
|
396
|
+
],
|
|
397
|
+
[
|
|
398
|
+
0.026097008342026252,
|
|
399
|
+
-0.14040957287568073,
|
|
400
|
+
0.133647539780504,
|
|
401
|
+
0.013962907145427432
|
|
402
|
+
]
|
|
403
|
+
)
|
|
404
|
+
pr1,pr2 = (
|
|
405
|
+
[
|
|
406
|
+
0.08779280979185472,
|
|
407
|
+
-0.23257704629617004,
|
|
408
|
+
0.1890698144343673,
|
|
409
|
+
-0.008125550119663026
|
|
410
|
+
],
|
|
411
|
+
[
|
|
412
|
+
-0.06273832689338121,
|
|
413
|
+
0.21909317812693613,
|
|
414
|
+
-0.23340488268623696,
|
|
415
|
+
-0.00812555011966309
|
|
416
|
+
]
|
|
417
|
+
)
|
|
418
|
+
pi1,pi2 = (
|
|
419
|
+
[
|
|
420
|
+
0.03553380678975111,
|
|
421
|
+
-0.021174189684500792,
|
|
422
|
+
-0.028159666883815007,
|
|
423
|
+
0.0009748746568893062
|
|
424
|
+
],
|
|
425
|
+
[
|
|
426
|
+
0.00911922467970264,
|
|
427
|
+
-0.0362286983251751,
|
|
428
|
+
0.1403094994141109,
|
|
429
|
+
0.0009748746568892609
|
|
430
|
+
]
|
|
431
|
+
)
|
|
432
|
+
pz1,pz2 = (
|
|
433
|
+
[
|
|
434
|
+
0.08071260245520126,
|
|
435
|
+
-0.051693023216670575,
|
|
436
|
+
-0.0739439627982131,
|
|
437
|
+
-0.0020460270205769223
|
|
438
|
+
],
|
|
439
|
+
[
|
|
440
|
+
0.09720715174271254,
|
|
441
|
+
-0.32063637962189184,
|
|
442
|
+
0.37918283208242526,
|
|
443
|
+
-0.0020460270205769305
|
|
444
|
+
]
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
cat['gmag'] = (
|
|
448
|
+
cat['gPSF']
|
|
449
|
+
+ np.polyval(pg1, cat['gPSF'] - cat['rPSF'])
|
|
450
|
+
+ np.polyval(pg2, cat['rPSF'] - cat['iPSF'])
|
|
451
|
+
)
|
|
452
|
+
cat['rmag'] = (
|
|
453
|
+
cat['rPSF']
|
|
454
|
+
+ np.polyval(pr1, cat['gPSF'] - cat['rPSF'])
|
|
455
|
+
+ np.polyval(pr2, cat['rPSF'] - cat['iPSF'])
|
|
456
|
+
)
|
|
457
|
+
cat['imag'] = (
|
|
458
|
+
cat['iPSF']
|
|
459
|
+
+ np.polyval(pi1, cat['gPSF'] - cat['rPSF'])
|
|
460
|
+
+ np.polyval(pi2, cat['rPSF'] - cat['iPSF'])
|
|
461
|
+
)
|
|
462
|
+
cat['zmag'] = (
|
|
463
|
+
cat['zPSF']
|
|
464
|
+
+ np.polyval(pz1, cat['gPSF'] - cat['rPSF'])
|
|
465
|
+
+ np.polyval(pz2, cat['rPSF'] - cat['iPSF'])
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
for _ in ['g', 'r', 'i', 'z']:
|
|
391
469
|
cat['e_' + _ + 'mag'] = cat['e_' + _ + 'PSF']
|
|
392
470
|
|
|
393
471
|
log("Augmenting the catalogue with Johnson-Cousins photometry")
|
|
394
472
|
|
|
395
|
-
# Johnson-Cousins,
|
|
473
|
+
# SkyMapper DR4 to Johnson-Cousins BVRI, my fit based on Pancino et al. (2022)
|
|
396
474
|
pB1, pB2 = (
|
|
397
475
|
[
|
|
398
|
-
0.
|
|
399
|
-
|
|
400
|
-
1.
|
|
401
|
-
0.
|
|
476
|
+
-0.22773918482205113,
|
|
477
|
+
0.1818124624962873,
|
|
478
|
+
1.0021365492384895,
|
|
479
|
+
0.10762635377473588
|
|
402
480
|
],
|
|
403
481
|
[
|
|
404
|
-
-0.
|
|
405
|
-
0.
|
|
406
|
-
-0.
|
|
407
|
-
0.
|
|
408
|
-
]
|
|
482
|
+
-0.004034933919297649,
|
|
483
|
+
0.08214592357213418,
|
|
484
|
+
-0.07535454054888649,
|
|
485
|
+
0.10762635377473558
|
|
486
|
+
]
|
|
409
487
|
)
|
|
410
488
|
pV1, pV2 = (
|
|
411
489
|
[
|
|
412
|
-
-0.
|
|
413
|
-
|
|
414
|
-
-0.
|
|
415
|
-
-0.
|
|
490
|
+
-0.02545732895304914,
|
|
491
|
+
0.03256423830249228,
|
|
492
|
+
-0.33074199873567045,
|
|
493
|
+
-0.002938730214382037
|
|
416
494
|
],
|
|
417
495
|
[
|
|
418
|
-
0.
|
|
419
|
-
0.
|
|
420
|
-
-0.
|
|
421
|
-
-0.
|
|
422
|
-
]
|
|
496
|
+
-0.007342074336918033,
|
|
497
|
+
0.08255055271047995,
|
|
498
|
+
-0.14349325478829064,
|
|
499
|
+
-0.0029387302143822
|
|
500
|
+
]
|
|
423
501
|
)
|
|
424
502
|
pR1, pR2 = (
|
|
425
503
|
[
|
|
426
|
-
0.
|
|
427
|
-
-0.
|
|
428
|
-
0.
|
|
429
|
-
-0.
|
|
504
|
+
0.07296699439306827,
|
|
505
|
+
-0.1943702618426095,
|
|
506
|
+
0.15375263988851387,
|
|
507
|
+
-0.08547735652048871
|
|
430
508
|
],
|
|
431
509
|
[
|
|
432
|
-
-0.
|
|
433
|
-
0.
|
|
434
|
-
-0.
|
|
435
|
-
-0.
|
|
436
|
-
]
|
|
510
|
+
-0.07378125129406726,
|
|
511
|
+
0.18462924970775316,
|
|
512
|
+
-0.40720945890364135,
|
|
513
|
+
-0.08547735652048903
|
|
514
|
+
]
|
|
437
515
|
)
|
|
438
516
|
pI1, pI2 = (
|
|
439
517
|
[
|
|
440
|
-
-0.
|
|
441
|
-
0.
|
|
442
|
-
-0.
|
|
443
|
-
-0.
|
|
518
|
+
-0.00925391710305653,
|
|
519
|
+
0.046223960182760516,
|
|
520
|
+
-0.06889215990613289,
|
|
521
|
+
-0.19321699685334734
|
|
444
522
|
],
|
|
445
523
|
[
|
|
446
|
-
0.
|
|
447
|
-
-0.
|
|
448
|
-
-
|
|
449
|
-
-0.
|
|
450
|
-
]
|
|
524
|
+
0.01197866152020802,
|
|
525
|
+
-0.044370062623186206,
|
|
526
|
+
-0.05231484699406009,
|
|
527
|
+
-0.19321699685334745
|
|
528
|
+
]
|
|
451
529
|
)
|
|
452
530
|
|
|
453
531
|
cat['Bmag'] = (
|
|
454
|
-
cat['
|
|
455
|
-
+ np.polyval(pB1, cat['
|
|
456
|
-
+ np.polyval(pB2, cat['
|
|
532
|
+
cat['gPSF']
|
|
533
|
+
+ np.polyval(pB1, cat['gPSF'] - cat['rPSF'])
|
|
534
|
+
+ np.polyval(pB2, cat['rPSF'] - cat['iPSF'])
|
|
457
535
|
)
|
|
458
536
|
cat['Vmag'] = (
|
|
459
|
-
cat['
|
|
460
|
-
+ np.polyval(pV1, cat['
|
|
461
|
-
+ np.polyval(pV2, cat['
|
|
537
|
+
cat['gPSF']
|
|
538
|
+
+ np.polyval(pV1, cat['gPSF'] - cat['rPSF'])
|
|
539
|
+
+ np.polyval(pV2, cat['rPSF'] - cat['iPSF'])
|
|
462
540
|
)
|
|
463
541
|
cat['Rmag'] = (
|
|
464
|
-
cat['
|
|
465
|
-
+ np.polyval(pR1, cat['
|
|
466
|
-
+ np.polyval(pR2, cat['
|
|
542
|
+
cat['rPSF']
|
|
543
|
+
+ np.polyval(pR1, cat['gPSF'] - cat['rPSF'])
|
|
544
|
+
+ np.polyval(pR2, cat['rPSF'] - cat['iPSF'])
|
|
467
545
|
)
|
|
468
546
|
cat['Imag'] = (
|
|
469
|
-
cat['
|
|
470
|
-
+ np.polyval(pI1, cat['
|
|
471
|
-
+ np.polyval(pI2, cat['
|
|
547
|
+
cat['iPSF']
|
|
548
|
+
+ np.polyval(pI1, cat['gPSF'] - cat['rPSF'])
|
|
549
|
+
+ np.polyval(pI2, cat['rPSF'] - cat['iPSF'])
|
|
472
550
|
)
|
|
473
551
|
|
|
474
552
|
cat['e_Bmag'] = cat['e_gmag']
|
|
@@ -514,7 +592,7 @@ def get_cat_vizier(
|
|
|
514
592
|
log("Converting the catalogue Sloan magnitudes to Pan-STARRS ones")
|
|
515
593
|
|
|
516
594
|
# umag, gmag, rmag, imag and zmag are Sloan ugriz magnitudes! Let's get PS1 ones instead
|
|
517
|
-
# Fits are based on clean Landolt sample from https://arxiv.org/pdf/
|
|
595
|
+
# Fits are based on clean Landolt sample from https://arxiv.org/pdf/2205.06186
|
|
518
596
|
pg = [-0.030414391501015867, -0.09960002492299584, -0.002910024005294562]
|
|
519
597
|
pr = [-0.009566553708653305, 0.014924591443344211, -0.003928147919030857]
|
|
520
598
|
pi = [-0.010802807724098494, 0.01124900218746879, 0.01274293783734852]
|
|
@@ -528,6 +606,16 @@ def get_cat_vizier(
|
|
|
528
606
|
cat['imag'] = cat['i_SDSS'] + np.polyval(pi, cat['g_SDSS'] - cat['r_SDSS'])
|
|
529
607
|
cat['zmag'] = cat['z_SDSS'] + np.polyval(pz, cat['g_SDSS'] - cat['r_SDSS'])
|
|
530
608
|
|
|
609
|
+
elif catalog == 'sdss':
|
|
610
|
+
log("Converting the catalogue Sloan magnitudes to AB ones")
|
|
611
|
+
|
|
612
|
+
# Zero point biases from https://www.sdss4.org/dr16/algorithms/fluxcal/#SDSStoAB
|
|
613
|
+
cat['umag'] -= 0.04
|
|
614
|
+
cat['zmag'] += 0.02
|
|
615
|
+
|
|
616
|
+
for _ in ['u', 'g', 'r', 'i', 'z']:
|
|
617
|
+
cat[_ + '_SDSS'] = cat[_ + 'mag']
|
|
618
|
+
|
|
531
619
|
return cat
|
|
532
620
|
|
|
533
621
|
|
|
@@ -91,18 +91,12 @@ def get_cutout(
|
|
|
91
91
|
image,
|
|
92
92
|
candidate,
|
|
93
93
|
radius,
|
|
94
|
-
mask=None,
|
|
95
|
-
background=None,
|
|
96
|
-
diff=None,
|
|
97
|
-
template=None,
|
|
98
|
-
convolved=None,
|
|
99
|
-
err=None,
|
|
100
|
-
footprint=None,
|
|
101
94
|
header=None,
|
|
102
95
|
wcs=None,
|
|
103
96
|
time=None,
|
|
104
97
|
filename=None,
|
|
105
98
|
name=None,
|
|
99
|
+
**kwargs
|
|
106
100
|
):
|
|
107
101
|
"""Create the cutout from one or more image planes based on the candidate object.
|
|
108
102
|
|
|
@@ -114,24 +108,18 @@ def get_cutout(
|
|
|
114
108
|
:param image: The science image for `image` plane of the cutout
|
|
115
109
|
:param candidate: The candidate object that should at least contain `x` and `y` fields
|
|
116
110
|
:param radius: Cutout radius in pixels. Cutout will have a square shape with :code:`2*ceil(radius) + 1` width
|
|
117
|
-
:param mask: The mask image for `mask` plane of the cutout, optional
|
|
118
|
-
:param background: The background for `background` plane of the cutout, optional
|
|
119
|
-
:param diff: Difference image for `diff` plane of the cutout, optional
|
|
120
|
-
:param template: Template image for `template` plane of the cutout, optional
|
|
121
|
-
:param convolved: Convolved template image for `convolved` plane of the cutout, optional
|
|
122
|
-
:param err: Noise model image for `err` plane of the cutout, optional
|
|
123
|
-
:param footprint: Candidate footprint (boolean) image for `footprint` plane of the cutout, optional
|
|
124
111
|
:param header: The header for original image. It will be copied to `header` field of the cutout and modified accordingly to properly represent the shape and WCS of the cutout. Optional
|
|
125
112
|
:param wcs: WCS for the original image. Will be copied to `wcs` field of the cutout with appropriate adjustment of the center so that it properly represents the astrometric solution on the cutout. Takes precedence over `header` parameter in defining cutout WCS. Optional
|
|
126
113
|
:param time: Time (:class:`astropy.time.Time` or :class:`datetime.datetime` or a string representation compatible with them) of the original image acquisition, to be copied to `time` field of the cutout. Optional
|
|
127
114
|
:param filename: Filename of the original image, to be stored in `filename` field of the cutout. Optional
|
|
128
115
|
:param name: The object name, to be stored in the `name` field of the cutout. Optional
|
|
116
|
+
:param \**kwargs: All additional keyword arguments are interpreted as additional image planes (e.g. mask, diff, template etc).
|
|
129
117
|
:returns: Cutout structure as described below.
|
|
130
118
|
|
|
131
119
|
Cutout is represented by a dictionary with at least the following fields:
|
|
132
120
|
|
|
133
121
|
- `image` - primary image plane, centered on the candidate position
|
|
134
|
-
- `mask`, `background`, `diff`, `template`, `convolved`, `err`, `footprint
|
|
122
|
+
- `mask`, `background`, `diff`, `template`, `convolved`, `err`, `footprint`, etc - corresponding secondary image planes, if provided as parameters to the routine
|
|
135
123
|
- `header` - header of the original image modified to properly represent the cutout WCS, if provided as a parameter to the routine
|
|
136
124
|
- `wcs` - WCS solution for the original image, modified to properly represent the cutout WCS, if provided as a parameter to the routine
|
|
137
125
|
- `meta` - dictionary of additional metadata for the cutout. It will be populated with all fields of the candidate object, plus additionally:
|
|
@@ -154,6 +142,10 @@ def get_cutout(
|
|
|
154
142
|
if wcs is not None:
|
|
155
143
|
cutout['wcs'] = wcs
|
|
156
144
|
|
|
145
|
+
# Let's update header info with this WCS
|
|
146
|
+
astrometry.clear_wcs(crophead, remove_underscored=True, remove_history=True)
|
|
147
|
+
crophead += wcs.to_header(relax=True)
|
|
148
|
+
|
|
157
149
|
if crophead is not None:
|
|
158
150
|
cutout['header'] = crophead
|
|
159
151
|
|
|
@@ -162,26 +154,9 @@ def get_cutout(
|
|
|
162
154
|
cutout['wcs'] = wcs
|
|
163
155
|
|
|
164
156
|
# Image planes
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if background is not None:
|
|
169
|
-
cutout['background'] = crop_image_centered(background, x0, y0, radius)
|
|
170
|
-
|
|
171
|
-
if diff is not None:
|
|
172
|
-
cutout['diff'] = crop_image_centered(diff, x0, y0, radius)
|
|
173
|
-
|
|
174
|
-
if template is not None:
|
|
175
|
-
cutout['template'] = crop_image_centered(template, x0, y0, radius)
|
|
176
|
-
|
|
177
|
-
if convolved is not None:
|
|
178
|
-
cutout['convolved'] = crop_image_centered(convolved, x0, y0, radius)
|
|
179
|
-
|
|
180
|
-
if err is not None:
|
|
181
|
-
cutout['err'] = crop_image_centered(err, x0, y0, radius)
|
|
182
|
-
|
|
183
|
-
if footprint is not None:
|
|
184
|
-
cutout['footprint'] = crop_image_centered(footprint, x0, y0, radius)
|
|
157
|
+
for pname,plane in kwargs.items():
|
|
158
|
+
if plane is not None and np.ndim(plane) == 2:
|
|
159
|
+
cutout[pname] = crop_image_centered(plane, x0, y0, radius)
|
|
185
160
|
|
|
186
161
|
# Metadata
|
|
187
162
|
for _ in candidate.keys():
|
|
@@ -229,6 +204,9 @@ def write_cutout(cutout, filename):
|
|
|
229
204
|
data = None
|
|
230
205
|
elif type(data) == Time or type(data) == datetime.datetime:
|
|
231
206
|
data = Time(data).to_value('fits')
|
|
207
|
+
elif not np.isscalar(data):
|
|
208
|
+
# NumPy arrays and like
|
|
209
|
+
data = repr(np.ma.filled(data))
|
|
232
210
|
elif np.isreal(data) and np.isnan(data):
|
|
233
211
|
data = 'NaN'
|
|
234
212
|
elif np.isreal(data) and not np.isfinite(data):
|
|
@@ -260,18 +238,8 @@ def write_cutout(cutout, filename):
|
|
|
260
238
|
hdus.append(hdu)
|
|
261
239
|
|
|
262
240
|
# Store imaging data to named extensions
|
|
263
|
-
for _ in
|
|
264
|
-
'
|
|
265
|
-
'template',
|
|
266
|
-
'convolved',
|
|
267
|
-
'diff',
|
|
268
|
-
'adjusted',
|
|
269
|
-
'mask',
|
|
270
|
-
'err',
|
|
271
|
-
'background',
|
|
272
|
-
'footprint',
|
|
273
|
-
]:
|
|
274
|
-
if _ in cutout:
|
|
241
|
+
for _ in cutout.keys():
|
|
242
|
+
if _ not in ['meta', 'header', 'wcs'] and np.ndim(cutout[_]) == 2:
|
|
275
243
|
data = cutout[_]
|
|
276
244
|
|
|
277
245
|
if data.dtype == bool:
|
|
@@ -305,6 +273,10 @@ def load_cutout(filename):
|
|
|
305
273
|
data = np.nan
|
|
306
274
|
elif data == 'Inf':
|
|
307
275
|
data = np.inf
|
|
276
|
+
elif isinstance(data, str) and data.startswith('array('):
|
|
277
|
+
# FIXME: any safer way to convert it back to array?..
|
|
278
|
+
array = np.array
|
|
279
|
+
data = eval(data)
|
|
308
280
|
|
|
309
281
|
cutout['meta'][name] = data
|
|
310
282
|
|
|
@@ -322,6 +294,9 @@ def load_cutout(filename):
|
|
|
322
294
|
|
|
323
295
|
hdus.close()
|
|
324
296
|
|
|
297
|
+
if cutout['header']:
|
|
298
|
+
cutout['wcs'] = WCS(cutout['header'])
|
|
299
|
+
|
|
325
300
|
return cutout
|
|
326
301
|
|
|
327
302
|
|
|
@@ -158,16 +158,16 @@ class LCs:
|
|
|
158
158
|
self.lcs[_] = []
|
|
159
159
|
self.lcs[_].append(__)
|
|
160
160
|
|
|
161
|
-
if i % N == 0 and verbose
|
|
161
|
+
if i % N == 0 and verbose == True:
|
|
162
162
|
sys.stdout.write("\r %d points - %d lcs" % (i, len(self.lcs['x'])))
|
|
163
163
|
sys.stdout.flush()
|
|
164
164
|
|
|
165
|
-
if verbose
|
|
165
|
+
if verbose == True:
|
|
166
166
|
sys.stdout.write("\n")
|
|
167
167
|
sys.stdout.flush()
|
|
168
168
|
|
|
169
169
|
for _ in self.lcs.keys():
|
|
170
|
-
if isinstance(self.lcs[_], list):
|
|
170
|
+
if isinstance(self.lcs[_], list) and _ not in ['ids']:
|
|
171
171
|
self.lcs[_] = np.array(self.lcs[_])
|
|
172
172
|
|
|
173
173
|
self.lcs['ra'], self.lcs['dec'] = astrometry.xyztoradec(
|