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.
Files changed (52) hide show
  1. timewise/__init__.py +1 -5
  2. timewise/backend/__init__.py +6 -0
  3. timewise/backend/base.py +36 -0
  4. timewise/backend/filesystem.py +80 -0
  5. timewise/chunking.py +50 -0
  6. timewise/cli.py +117 -11
  7. timewise/config.py +34 -0
  8. timewise/io/__init__.py +1 -0
  9. timewise/io/config.py +64 -0
  10. timewise/io/download.py +302 -0
  11. timewise/io/stable_tap.py +121 -0
  12. timewise/plot/__init__.py +3 -0
  13. timewise/plot/diagnostic.py +242 -0
  14. timewise/plot/lightcurve.py +112 -0
  15. timewise/plot/panstarrs.py +260 -0
  16. timewise/plot/sdss.py +109 -0
  17. timewise/process/__init__.py +2 -0
  18. timewise/process/config.py +34 -0
  19. timewise/process/interface.py +143 -0
  20. timewise/process/keys.py +10 -0
  21. timewise/process/stacking.py +322 -0
  22. timewise/process/template.yml +49 -0
  23. timewise/query/__init__.py +6 -0
  24. timewise/query/base.py +45 -0
  25. timewise/query/positional.py +40 -0
  26. timewise/tables/__init__.py +10 -0
  27. timewise/tables/allwise_p3as_mep.py +22 -0
  28. timewise/tables/base.py +9 -0
  29. timewise/tables/neowiser_p1bs_psd.py +22 -0
  30. timewise/types.py +30 -0
  31. timewise/util/backoff.py +12 -0
  32. timewise/util/csv_utils.py +12 -0
  33. timewise/util/error_threading.py +70 -0
  34. timewise/util/visits.py +33 -0
  35. timewise-1.0.0a2.dist-info/METADATA +205 -0
  36. timewise-1.0.0a2.dist-info/RECORD +39 -0
  37. timewise-1.0.0a2.dist-info/entry_points.txt +3 -0
  38. timewise/big_parent_sample.py +0 -106
  39. timewise/config_loader.py +0 -157
  40. timewise/general.py +0 -52
  41. timewise/parent_sample_base.py +0 -89
  42. timewise/point_source_utils.py +0 -68
  43. timewise/utils.py +0 -558
  44. timewise/wise_bigdata_desy_cluster.py +0 -1407
  45. timewise/wise_data_base.py +0 -2027
  46. timewise/wise_data_by_visit.py +0 -672
  47. timewise/wise_flux_conversion_correction.dat +0 -19
  48. timewise-0.5.4.dist-info/METADATA +0 -56
  49. timewise-0.5.4.dist-info/RECORD +0 -17
  50. timewise-0.5.4.dist-info/entry_points.txt +0 -3
  51. {timewise-0.5.4.dist-info → timewise-1.0.0a2.dist-info}/WHEEL +0 -0
  52. {timewise-0.5.4.dist-info → timewise-1.0.0a2.dist-info}/licenses/LICENSE +0 -0
@@ -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)
@@ -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
- ###########################################################################################################