timewise 1.0.0a7__py3-none-any.whl → 1.0.0a8__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.
@@ -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
timewise/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.0.0a7"
1
+ __version__ = "1.0.0a8"
timewise/chunking.py CHANGED
@@ -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):
timewise/io/download.py CHANGED
@@ -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!"
timewise/io/stable_tap.py CHANGED
@@ -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,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
@@ -2,24 +2,24 @@ ampel/timewise/alert/TimewiseAlertSupplier.py,sha256=HLeQBCLrmVKxqvPc4E2TVj241KW
2
2
  ampel/timewise/alert/load/TimewiseFileLoader.py,sha256=jmLppFEJwjQCSOMUtr-cSP9UbtT0VzqyAf4VDJjUf3w,4409
3
3
  ampel/timewise/ingest/TiCompilerOptions.py,sha256=j2eUxSkJEKxAjJCd9plxRRCg6Mv8dNHw72UvKyAxUsA,809
4
4
  ampel/timewise/ingest/TiDataPointShaper.py,sha256=KbAg-J0DkMaJA9K67xMY5Pe0SIP0LNKsBNAMnTYV9zA,3180
5
- ampel/timewise/ingest/TiMongoMuxer.py,sha256=YDiqaYiJ1TvyHUMAlNWHBHCpw0tH4Nvf8eyHUxMbzS8,6475
5
+ ampel/timewise/ingest/TiMongoMuxer.py,sha256=Rg6yGI7AoPZhyXUsYmGD8ZiivyaLT-EJjG-U4J4yh-w,6467
6
6
  ampel/timewise/ingest/tags.py,sha256=ggn0Y6QUnjIwMzOlgKmPX1JPhmnvc21nUrORFhaR0uI,564
7
7
  ampel/timewise/t1/T1HDBSCAN.py,sha256=zVhcqQVAjlHgDBd9CJA6rGH3RCrCV84rsIIOWVxODKI,9528
8
8
  ampel/timewise/t1/TimewiseFilter.py,sha256=uDjNGsqPOISoFjSH8tX87I3UTW9qGX8rEmkyze8u2ug,1566
9
9
  ampel/timewise/t2/T2StackVisits.py,sha256=JBxFZLT-a-8jjenRw45ZVA_FvtcyOBmvMVcpYHyw_Yk,2574
10
10
  ampel/timewise/util/AuxDiagnosticPlotter.py,sha256=evvuH5vuEOFkfbkoSQw7ztiEqHos19PP91VQ_SCg_AU,1692
11
11
  ampel/timewise/util/pdutil.py,sha256=CJqeYqL2I6A5WnF5S342bwM4omJY-1XwT1XWY2uk3bc,1524
12
- timewise/__init__.py,sha256=E7xUjDtIcRMszsR5_yuDt--zdfFpDV9LyF3s2kNKZCU,24
12
+ timewise/__init__.py,sha256=uSPlLo1iPfJHnwgxEbL4lAcPqtOK8qgwkOr4GpzJSyo,24
13
13
  timewise/backend/__init__.py,sha256=w79nWfCw8n9g98CkHWJELmb4j9xblWC4DGZOV3_XhH4,134
14
14
  timewise/backend/base.py,sha256=dHxRzu2q3uQ0wdGmDxnn-p68Tp19qChue7HMEu56wNA,1080
15
15
  timewise/backend/filesystem.py,sha256=qFBmiOtfv8b3uhhiZSbH8bRIUrpS4f0P8Zl03VxpgAI,2598
16
- timewise/chunking.py,sha256=uAfAOhWg1v6VbfHNkhBLSCEa0GehPoIZPftGueVmNRs,1845
16
+ timewise/chunking.py,sha256=eRd3xof-5uHaxo8Pmwo4kr_cdZSfFpgTiPu-xuL-SGA,2404
17
17
  timewise/cli.py,sha256=W8SXlUQo7a5aS4_kW40KTs2UkTLQS12JuhgwkRb23DY,4172
18
18
  timewise/config.py,sha256=ZTSokRZMZDqBqVFV9DxvO-47yE9E9xWF48Rcjb0QG10,1044
19
19
  timewise/io/__init__.py,sha256=S7vb0glKJnw6ztOlrD-0Wma2bQZ2RwpmXDLFJLKBMVo,35
20
20
  timewise/io/config.py,sha256=u_nlfstvuz2_bfepRZo3y43XAqQ0ilReYg9e081CTQg,2410
21
- timewise/io/download.py,sha256=IMNWur1FWPKJ7SNMTjevZgWqPP_eYLzXr4Pjp3XOeXI,10589
22
- timewise/io/stable_tap.py,sha256=jukCkBi2d7WACOo_kXTMCppzWUsN-pLVg9EDqHi3qd0,3478
21
+ timewise/io/download.py,sha256=4uKWIPD61wLk6rPLiX72yjByDFgrRR7ww4LzsDfVugE,10019
22
+ timewise/io/stable_tap.py,sha256=obwzic_xvB_hh-x6S5NT4bW847emabKxp8NH1WgAh-g,3899
23
23
  timewise/plot/__init__.py,sha256=cc00UenWC_8zAkBH-Ylhs3yCF49tAqZ2Al9MfOoXYDI,120
24
24
  timewise/plot/diagnostic.py,sha256=GRp-OUwz2yzzDu9qdViFg_e3Mxl5t1IvUJXZHuMKB2U,8276
25
25
  timewise/plot/lightcurve.py,sha256=K0UvjmvbCSsRKP3Mu9X5L5AVUwqURR76ESJCIMEgE6Q,3924
@@ -44,8 +44,8 @@ timewise/util/csv_utils.py,sha256=5i3Jd4c58-doPs1N_hyYZ8Uc2nvuk9nGwgPNZoNrlu0,29
44
44
  timewise/util/error_threading.py,sha256=uyV1Ri-wf87lpa17Xlp520B1V8DWHh3v9Mk97QrPmv0,2264
45
45
  timewise/util/path.py,sha256=-CcpYdjidg5FcZnRyQqrK_EKjc-7USYbJ8gtKatGl6k,254
46
46
  timewise/util/visits.py,sha256=4ZXwH7OXmp98tUPZplvuOtykB048kZoYXyuRTwQxT7w,998
47
- timewise-1.0.0a7.dist-info/METADATA,sha256=r8fAKUybkR-ACivlwDuMi2_6p7ey6Ia_qycCNsyxYIs,10294
48
- timewise-1.0.0a7.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
49
- timewise-1.0.0a7.dist-info/entry_points.txt,sha256=mYh1HsUFbV7KT8kxiGqVtR3Pk0oEk6Bd-2c5FsYVhG4,45
50
- timewise-1.0.0a7.dist-info/licenses/LICENSE,sha256=sVoNJWiTlH-NarJx0wdsob468Pg3JE6vIIgll4lCa3E,1070
51
- timewise-1.0.0a7.dist-info/RECORD,,
47
+ timewise-1.0.0a8.dist-info/METADATA,sha256=QnfpFxRvJDiL_a5Z0ElFj6_F1Mylk4bscAqE0SCNjxE,10308
48
+ timewise-1.0.0a8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
49
+ timewise-1.0.0a8.dist-info/entry_points.txt,sha256=mYh1HsUFbV7KT8kxiGqVtR3Pk0oEk6Bd-2c5FsYVhG4,45
50
+ timewise-1.0.0a8.dist-info/licenses/LICENSE,sha256=sVoNJWiTlH-NarJx0wdsob468Pg3JE6vIIgll4lCa3E,1070
51
+ timewise-1.0.0a8.dist-info/RECORD,,