timewise 1.0.0a7__tar.gz → 1.0.0a8__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.
Files changed (51) hide show
  1. {timewise-1.0.0a7 → timewise-1.0.0a8}/PKG-INFO +4 -4
  2. {timewise-1.0.0a7 → timewise-1.0.0a8}/README.md +3 -3
  3. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/ingest/TiMongoMuxer.py +4 -6
  4. {timewise-1.0.0a7 → timewise-1.0.0a8}/pyproject.toml +1 -1
  5. timewise-1.0.0a8/timewise/__init__.py +1 -0
  6. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/chunking.py +18 -1
  7. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/io/download.py +1 -16
  8. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/io/stable_tap.py +17 -0
  9. timewise-1.0.0a7/timewise/__init__.py +0 -1
  10. {timewise-1.0.0a7 → timewise-1.0.0a8}/LICENSE +0 -0
  11. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/alert/TimewiseAlertSupplier.py +0 -0
  12. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/alert/load/TimewiseFileLoader.py +0 -0
  13. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/ingest/TiCompilerOptions.py +0 -0
  14. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/ingest/TiDataPointShaper.py +0 -0
  15. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/ingest/tags.py +0 -0
  16. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/t1/T1HDBSCAN.py +0 -0
  17. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/t1/TimewiseFilter.py +0 -0
  18. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/t2/T2StackVisits.py +0 -0
  19. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/util/AuxDiagnosticPlotter.py +0 -0
  20. {timewise-1.0.0a7 → timewise-1.0.0a8}/ampel/timewise/util/pdutil.py +0 -0
  21. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/backend/__init__.py +0 -0
  22. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/backend/base.py +0 -0
  23. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/backend/filesystem.py +0 -0
  24. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/cli.py +0 -0
  25. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/config.py +0 -0
  26. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/io/__init__.py +0 -0
  27. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/io/config.py +0 -0
  28. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/plot/__init__.py +0 -0
  29. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/plot/diagnostic.py +0 -0
  30. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/plot/lightcurve.py +0 -0
  31. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/plot/panstarrs.py +0 -0
  32. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/plot/sdss.py +0 -0
  33. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/process/__init__.py +0 -0
  34. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/process/config.py +0 -0
  35. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/process/interface.py +0 -0
  36. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/process/keys.py +0 -0
  37. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/process/stacking.py +0 -0
  38. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/process/template.yml +0 -0
  39. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/query/__init__.py +0 -0
  40. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/query/base.py +0 -0
  41. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/query/positional.py +0 -0
  42. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/tables/__init__.py +0 -0
  43. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/tables/allwise_p3as_mep.py +0 -0
  44. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/tables/base.py +0 -0
  45. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/tables/neowiser_p1bs_psd.py +0 -0
  46. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/types.py +0 -0
  47. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/util/backoff.py +0 -0
  48. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/util/csv_utils.py +0 -0
  49. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/util/error_threading.py +0 -0
  50. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/util/path.py +0 -0
  51. {timewise-1.0.0a7 → timewise-1.0.0a8}/timewise/util/visits.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: timewise
3
- Version: 1.0.0a7
3
+ Version: 1.0.0a8
4
4
  Summary: Download WISE infrared data for many objects and process them with AMPEL
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -63,7 +63,7 @@ Description-Content-Type: text/markdown
63
63
  This package downloads WISE data for positions on the sky and stacks single-exposure photometry per visit
64
64
 
65
65
  ## Prerequisites
66
- Python version 3.11.
66
+ Python version 3.11, 3.12 or 3.13.
67
67
 
68
68
  If you want to not only download individual exposure photometry but also stack detections per visit (see below),
69
69
  you must have access to a running [MongoDB](https://www.mongodb.com/)*.
@@ -77,12 +77,12 @@ to get the MongoDB community edition. </sub>
77
77
  ### If you use timewise only for downloading
78
78
  The package can be installed via `pip` (but make sure to install the v1 pre-release):
79
79
  ```bash
80
- pip install --pre timewise==1.0.0a6
80
+ pip install --pre timewise==1.0.0a8
81
81
  ```
82
82
  ### If you use timewise also for stacking individual exposures
83
83
  You must install with the `ampel` extra:
84
84
  ```bash
85
- pip install --pre 'timewise[ampel]==1.0.0a6'
85
+ pip install --pre 'timewise[ampel]==1.0.0a8'
86
86
  ```
87
87
  To tell AMPEL which modules, aka units, to use, build the corresponding configuration file:
88
88
  ```bash
@@ -10,7 +10,7 @@
10
10
  This package downloads WISE data for positions on the sky and stacks single-exposure photometry per visit
11
11
 
12
12
  ## Prerequisites
13
- Python version 3.11.
13
+ Python version 3.11, 3.12 or 3.13.
14
14
 
15
15
  If you want to not only download individual exposure photometry but also stack detections per visit (see below),
16
16
  you must have access to a running [MongoDB](https://www.mongodb.com/)*.
@@ -24,12 +24,12 @@ to get the MongoDB community edition. </sub>
24
24
  ### If you use timewise only for downloading
25
25
  The package can be installed via `pip` (but make sure to install the v1 pre-release):
26
26
  ```bash
27
- pip install --pre timewise==1.0.0a6
27
+ pip install --pre timewise==1.0.0a8
28
28
  ```
29
29
  ### If you use timewise also for stacking individual exposures
30
30
  You must install with the `ampel` extra:
31
31
  ```bash
32
- pip install --pre 'timewise[ampel]==1.0.0a6'
32
+ pip install --pre 'timewise[ampel]==1.0.0a8'
33
33
  ```
34
34
  To tell AMPEL which modules, aka units, to use, build the corresponding configuration file:
35
35
  ```bash
@@ -32,7 +32,7 @@ class TiMongoMuxer(AbsT0Muxer):
32
32
  """
33
33
 
34
34
  # Standard projection used when checking DB for existing PPS/ULS
35
- projection = {
35
+ projection: dict[str, int] = {
36
36
  "_id": 0,
37
37
  "id": 1,
38
38
  "tag": 1,
@@ -51,6 +51,8 @@ class TiMongoMuxer(AbsT0Muxer):
51
51
  "body.dec": 1,
52
52
  }
53
53
 
54
+ unique_key: list[str] = ["mjd", "ra", "dec"]
55
+
54
56
  def __init__(self, **kwargs) -> None:
55
57
  super().__init__(**kwargs)
56
58
 
@@ -116,11 +118,7 @@ class TiMongoMuxer(AbsT0Muxer):
116
118
  # jd alone is not enough for matching pps because each time is associated with
117
119
  # two filters! Also, if there can be multiple sources within the same frame which
118
120
  # leads to duplicate MJD and FID. Check position in addition.
119
- key = (
120
- dp["body"]["mjd"],
121
- dp["body"]["ra"],
122
- dp["body"]["dec"],
123
- )
121
+ key = tuple(dp["body"][k] for k in self.unique_key)
124
122
 
125
123
  if target := unique_dps_ids.get(key):
126
124
  # insert id in order
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [project]
6
6
  name = "timewise"
7
- version = "1.0.0a7"
7
+ version = "1.0.0a8"
8
8
  description = "Download WISE infrared data for many objects and process them with AMPEL"
9
9
  authors = [
10
10
  { name = "Jannis Necker", email = "jannis.necker@gmail.com" },
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0a8"
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  from functools import cached_property
3
3
  from pathlib import Path
4
- from typing import Iterator
4
+ from typing import Iterator, Sequence, cast
5
5
 
6
6
  import numpy as np
7
7
  import pandas as pd
@@ -24,6 +24,23 @@ class Chunk:
24
24
  stop = max(self.row_numbers) + 1
25
25
  return pd.read_csv(self.input_csv, skiprows=start, nrows=stop - start).index
26
26
 
27
+ @property
28
+ def data(self) -> pd.DataFrame:
29
+ start = (
30
+ min(cast(Sequence[int], self.row_numbers)) + 1
31
+ ) # plus one to always skip header line
32
+ nrows = (
33
+ max(cast(Sequence[int], self.row_numbers)) - start + 2
34
+ ) # plus one: skip header, plus one:
35
+
36
+ columns = list(pd.read_csv(self.input_csv, nrows=0).columns)
37
+ return pd.read_csv(
38
+ filepath_or_buffer=self.input_csv,
39
+ skiprows=start,
40
+ nrows=nrows,
41
+ names=columns,
42
+ )
43
+
27
44
 
28
45
  class Chunker:
29
46
  def __init__(self, input_csv: Path, chunk_size: int):
@@ -106,25 +106,10 @@ class Downloader:
106
106
  # ----------------------------
107
107
  # TAP submission and download
108
108
  # ----------------------------
109
- def get_chunk_data(self, chunk: Chunk) -> pd.DataFrame:
110
- start = (
111
- min(cast(Sequence[int], chunk.row_numbers)) + 1
112
- ) # plus one to always skip header line
113
- nrows = (
114
- max(cast(Sequence[int], chunk.row_numbers)) - start + 2
115
- ) # plus one: skip header, plus one:
116
-
117
- columns = list(pd.read_csv(self.input_csv, nrows=0).columns)
118
- return pd.read_csv(
119
- filepath_or_buffer=self.input_csv,
120
- skiprows=start,
121
- nrows=nrows,
122
- names=columns,
123
- )
124
109
 
125
110
  def submit_tap_job(self, query: Query, chunk: Chunk) -> TAPJobMeta:
126
111
  adql = query.adql
127
- chunk_df = self.get_chunk_data(chunk)
112
+ chunk_df = chunk.data
128
113
 
129
114
  assert all(chunk_df.index.isin(chunk.indices)), (
130
115
  "Some inputs loaded from wrong chunk!"
@@ -3,6 +3,8 @@ import backoff
3
3
  import pyvo as vo
4
4
  from xml.etree import ElementTree
5
5
 
6
+ import requests
7
+
6
8
  from timewise.util.backoff import backoff_hndlr
7
9
 
8
10
 
@@ -20,6 +22,12 @@ class StableAsyncTAPJob(vo.dal.AsyncTAPJob):
20
22
  self.submit_response = None
21
23
 
22
24
  @classmethod
25
+ @backoff.on_exception(
26
+ backoff.expo,
27
+ requests.exceptions.HTTPError,
28
+ max_tries=5,
29
+ on_backoff=backoff_hndlr,
30
+ )
23
31
  def create(
24
32
  cls,
25
33
  baseurl,
@@ -89,6 +97,15 @@ class StableAsyncTAPJob(vo.dal.AsyncTAPJob):
89
97
  def phase(self):
90
98
  return super(StableAsyncTAPJob, self).phase
91
99
 
100
+ @backoff.on_exception(
101
+ backoff.expo,
102
+ vo.dal.DALServiceError,
103
+ max_tries=50,
104
+ on_backoff=backoff_hndlr,
105
+ )
106
+ def _update(self, *args, **kwargs):
107
+ return super(StableAsyncTAPJob, self)._update(*args, **kwargs)
108
+
92
109
 
93
110
  class StableTAPService(vo.dal.TAPService):
94
111
  """
@@ -1 +0,0 @@
1
- __version__ = "1.0.0a7"
File without changes
File without changes
File without changes