timewise 0.5.4__py3-none-any.whl → 1.0.0a2__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.
- timewise/__init__.py +1 -5
- timewise/backend/__init__.py +6 -0
- timewise/backend/base.py +36 -0
- timewise/backend/filesystem.py +80 -0
- timewise/chunking.py +50 -0
- timewise/cli.py +117 -11
- timewise/config.py +34 -0
- timewise/io/__init__.py +1 -0
- timewise/io/config.py +64 -0
- timewise/io/download.py +302 -0
- timewise/io/stable_tap.py +121 -0
- timewise/plot/__init__.py +3 -0
- timewise/plot/diagnostic.py +242 -0
- timewise/plot/lightcurve.py +112 -0
- timewise/plot/panstarrs.py +260 -0
- timewise/plot/sdss.py +109 -0
- timewise/process/__init__.py +2 -0
- timewise/process/config.py +34 -0
- timewise/process/interface.py +143 -0
- timewise/process/keys.py +10 -0
- timewise/process/stacking.py +322 -0
- timewise/process/template.yml +49 -0
- timewise/query/__init__.py +6 -0
- timewise/query/base.py +45 -0
- timewise/query/positional.py +40 -0
- timewise/tables/__init__.py +10 -0
- timewise/tables/allwise_p3as_mep.py +22 -0
- timewise/tables/base.py +9 -0
- timewise/tables/neowiser_p1bs_psd.py +22 -0
- timewise/types.py +30 -0
- timewise/util/backoff.py +12 -0
- timewise/util/csv_utils.py +12 -0
- timewise/util/error_threading.py +70 -0
- timewise/util/visits.py +33 -0
- timewise-1.0.0a2.dist-info/METADATA +205 -0
- timewise-1.0.0a2.dist-info/RECORD +39 -0
- timewise-1.0.0a2.dist-info/entry_points.txt +3 -0
- timewise/big_parent_sample.py +0 -106
- timewise/config_loader.py +0 -157
- timewise/general.py +0 -52
- timewise/parent_sample_base.py +0 -89
- timewise/point_source_utils.py +0 -68
- timewise/utils.py +0 -558
- timewise/wise_bigdata_desy_cluster.py +0 -1407
- timewise/wise_data_base.py +0 -2027
- timewise/wise_data_by_visit.py +0 -672
- timewise/wise_flux_conversion_correction.dat +0 -19
- timewise-0.5.4.dist-info/METADATA +0 -56
- timewise-0.5.4.dist-info/RECORD +0 -17
- timewise-0.5.4.dist-info/entry_points.txt +0 -3
- {timewise-0.5.4.dist-info → timewise-1.0.0a2.dist-info}/WHEEL +0 -0
- {timewise-0.5.4.dist-info → timewise-1.0.0a2.dist-info}/licenses/LICENSE +0 -0
timewise/parent_sample_base.py
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import abc, os
|
|
2
|
-
import pandas as pd
|
|
3
|
-
import numpy as np
|
|
4
|
-
import logging
|
|
5
|
-
|
|
6
|
-
from timewise.general import get_directories
|
|
7
|
-
from timewise.utils import plot_sdss_cutout, plot_panstarrs_cutout
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
logger = logging.getLogger(__name__)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class ParentSampleBase(abc.ABC):
|
|
14
|
-
"""
|
|
15
|
-
Base class for parent sample.
|
|
16
|
-
Any subclass must implement
|
|
17
|
-
|
|
18
|
-
- `ParentSample.df`: A `pandas.DataFrame` consisting of minimum three columns: two columns holding the sky positions of each object in the form of right ascension and declination and one row with a unique identifier.
|
|
19
|
-
- `ParentSample.default_keymap`: a dictionary, mapping the column in `ParentSample.df` to 'ra', 'dec' and 'id'
|
|
20
|
-
|
|
21
|
-
:param base_name: determining the location of any data in the `timewise` data directory.
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
df = pd.DataFrame()
|
|
25
|
-
default_keymap = dict()
|
|
26
|
-
|
|
27
|
-
def __init__(self, base_name):
|
|
28
|
-
# set up directories
|
|
29
|
-
d = get_directories()
|
|
30
|
-
self.cache_dir = d["cache_dir"] / base_name
|
|
31
|
-
self.plots_dir = d["plots_dir"] / base_name
|
|
32
|
-
|
|
33
|
-
for d in [self.cache_dir, self.plots_dir]:
|
|
34
|
-
d.parent.mkdir(parents=True, exist_ok=True)
|
|
35
|
-
|
|
36
|
-
self.local_sample_copy = self.cache_dir / 'sample.csv'
|
|
37
|
-
|
|
38
|
-
def plot_cutout(self, ind, arcsec=20, interactive=False, **kwargs):
|
|
39
|
-
"""
|
|
40
|
-
Plot the coutout images in all filters around the position of object with index i
|
|
41
|
-
|
|
42
|
-
:param ind: the index in the sample
|
|
43
|
-
:type ind: int or list-like
|
|
44
|
-
:param arcsec: the radius of the cutout
|
|
45
|
-
:type arcsec: float
|
|
46
|
-
:param interactive: interactive mode
|
|
47
|
-
:type interactive: bool
|
|
48
|
-
:param kwargs: any additional kwargs will be passed to `matplotlib.pyplot.subplots()`
|
|
49
|
-
:return: figure and axes if `interactive=True`
|
|
50
|
-
"""
|
|
51
|
-
sel = self.df.loc[np.atleast_1d(ind)]
|
|
52
|
-
ra, dec = sel[self.default_keymap["ra"]], sel[self.default_keymap["dec"]]
|
|
53
|
-
title = [r[self.default_keymap["id"]] for i, r in sel.iterrows()]
|
|
54
|
-
|
|
55
|
-
fn = kwargs.pop(
|
|
56
|
-
"fn",
|
|
57
|
-
[self.plots_dir / f"{i}_{r[self.default_keymap['id']]}.pdf"
|
|
58
|
-
for i, r in sel.iterrows()]
|
|
59
|
-
)
|
|
60
|
-
self.plots_dir.mkdir(parents=True, exist_ok=True)
|
|
61
|
-
|
|
62
|
-
logger.debug(f"\nRA: {ra}\nDEC: {dec}\nTITLE: {title}\nFN: {fn}")
|
|
63
|
-
ou = list()
|
|
64
|
-
|
|
65
|
-
ras = np.atleast_1d(ra)
|
|
66
|
-
decs = np.atleast_1d(dec)
|
|
67
|
-
title = np.atleast_1d(title) if title else [None] * len(ras)
|
|
68
|
-
fn = np.atleast_1d(fn) if fn else [None] * len(ras)
|
|
69
|
-
|
|
70
|
-
for _ra, _dec, _title, _fn in zip(ras, decs, title, fn):
|
|
71
|
-
ou.append(self._plot_cutout(_ra, _dec, arcsec, interactive, title=_title, fn=_fn, **kwargs))
|
|
72
|
-
|
|
73
|
-
if len(ou) == 1:
|
|
74
|
-
ou = ou[0]
|
|
75
|
-
return ou
|
|
76
|
-
|
|
77
|
-
@staticmethod
|
|
78
|
-
def _plot_cutout(ra, dec, arcsec, interactive, which="sdss", **kwargs):
|
|
79
|
-
if which == "sdss":
|
|
80
|
-
return plot_sdss_cutout(ra, dec, arcsec=arcsec, interactive=interactive, **kwargs)
|
|
81
|
-
elif which == "panstarrs":
|
|
82
|
-
return plot_panstarrs_cutout(ra, dec, arcsec=arcsec, interactive=interactive, **kwargs)
|
|
83
|
-
else:
|
|
84
|
-
raise ValueError(f"{which} not an implemented survey! Choose one of 'sdss' or 'panstarrs'.")
|
|
85
|
-
|
|
86
|
-
def save_local(self):
|
|
87
|
-
logger.debug(f"saving under {self.local_sample_copy}")
|
|
88
|
-
self.local_sample_copy.parent.mkdir(parents=True, exist_ok=True)
|
|
89
|
-
self.df.to_csv(self.local_sample_copy)
|
timewise/point_source_utils.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import pandas as pd
|
|
3
|
-
|
|
4
|
-
from timewise.parent_sample_base import ParentSampleBase
|
|
5
|
-
from timewise.wise_data_by_visit import WiseDataByVisit
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
logger = logging.getLogger(__name__)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
###########################################################################################################
|
|
12
|
-
# START POINT SOURCE UTILS #
|
|
13
|
-
#####################################################
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def get_point_source_parent_sample(base_name, ra, dec):
|
|
17
|
-
|
|
18
|
-
class PointSourceParentSample(ParentSampleBase):
|
|
19
|
-
default_keymap = {
|
|
20
|
-
'ra': 'ra',
|
|
21
|
-
'dec': 'dec',
|
|
22
|
-
'id': 'id'
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
def __init__(self):
|
|
26
|
-
|
|
27
|
-
super().__init__(base_name=base_name)
|
|
28
|
-
|
|
29
|
-
self.base_name = base_name
|
|
30
|
-
self.df = pd.DataFrame({'ra': [ra], 'dec': [dec], 'id': [base_name]})
|
|
31
|
-
|
|
32
|
-
def save_local(self):
|
|
33
|
-
logger.debug(f"not saving")
|
|
34
|
-
|
|
35
|
-
return PointSourceParentSample
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def get_point_source_wise_data(base_name, ra, dec, min_sep_arcsec=10, match=False, **kwargs):
|
|
39
|
-
"""
|
|
40
|
-
Get a WISEData instance for a point source
|
|
41
|
-
|
|
42
|
-
:param base_name: base name for storage in the data directory
|
|
43
|
-
:type base_name: str
|
|
44
|
-
:param ra: right ascencion
|
|
45
|
-
:type ra: float
|
|
46
|
-
:param dec: declination
|
|
47
|
-
:type dec: float
|
|
48
|
-
:param min_sep_arcsec: search radius in arcsec
|
|
49
|
-
:type min_sep_arcsec: float
|
|
50
|
-
:param match: match to AllWISE Source Catalogue
|
|
51
|
-
:type match: bool
|
|
52
|
-
:param kwargs: keyword arguments passed to WISEData.get_photometric_data()
|
|
53
|
-
:type kwargs: dict
|
|
54
|
-
:return: WISEData
|
|
55
|
-
"""
|
|
56
|
-
ps = get_point_source_parent_sample(base_name, ra, dec)
|
|
57
|
-
wd = WiseDataByVisit(n_chunks=1, base_name=base_name, parent_sample_class=ps, min_sep_arcsec=min_sep_arcsec)
|
|
58
|
-
if match:
|
|
59
|
-
wd.match_all_chunks()
|
|
60
|
-
service = kwargs.pop('service', 'gator')
|
|
61
|
-
wd.get_photometric_data(service=service, **kwargs)
|
|
62
|
-
wd.plot_lc(parent_sample_idx=0, service=service)
|
|
63
|
-
return wd
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
#####################################################
|
|
67
|
-
# END POINT SOURCE UTILS #
|
|
68
|
-
###########################################################################################################
|