a2p2 0.7.6__py3-none-any.whl → 0.7.8__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.
- a2p2/jmmc/catalogs.py +18 -6
- a2p2/version.py +10 -2
- {a2p2-0.7.6.dist-info → a2p2-0.7.8.dist-info}/METADATA +1 -1
- {a2p2-0.7.6.dist-info → a2p2-0.7.8.dist-info}/RECORD +8 -8
- {a2p2-0.7.6.dist-info → a2p2-0.7.8.dist-info}/WHEEL +1 -1
- {a2p2-0.7.6.dist-info → a2p2-0.7.8.dist-info}/entry_points.txt +0 -0
- {a2p2-0.7.6.dist-info → a2p2-0.7.8.dist-info}/licenses/LICENSE +0 -0
- {a2p2-0.7.6.dist-info → a2p2-0.7.8.dist-info}/top_level.txt +0 -0
a2p2/jmmc/catalogs.py
CHANGED
@@ -26,6 +26,9 @@ class Catalog():
|
|
26
26
|
|
27
27
|
def __init__(self, catalogName, username=None, password=None, prod=False, apiUrl=None, tapUrl=None, where=None, joins=None):
|
28
28
|
self.catalogName = catalogName
|
29
|
+
self.updated = False
|
30
|
+
self.lastTable = None
|
31
|
+
self.lastDataFrame = None
|
29
32
|
self.where = where
|
30
33
|
self.joins = joins
|
31
34
|
self.prod = prod
|
@@ -91,21 +94,26 @@ class Catalog():
|
|
91
94
|
"""
|
92
95
|
return self.api._get(f"/{self.catalogName}/{id}")
|
93
96
|
|
94
|
-
def getDataFrame(self):
|
97
|
+
def getDataFrame(self, forceUpdate=False):
|
95
98
|
""" Get a pandas DataFrame from the main catalog joined the other if provided in constructor.
|
96
99
|
|
97
100
|
usage: cat.getDataFrame()
|
98
101
|
"""
|
102
|
+
if not ( self.updated or forceUpdate or self.lastDataFrame is None):
|
103
|
+
return self.lastDataFrame
|
104
|
+
self.lastDataFrame = self.getTable(forceUpdate=forceUpdate).to_pandas()
|
105
|
+
return self.lastDataFrame
|
99
106
|
|
100
|
-
|
101
|
-
|
102
|
-
def getTable(self, maxrec=10000):
|
107
|
+
def getTable(self, maxrec=10000, forceUpdate=False):
|
103
108
|
""" Get an astropy table from the main catalog joined the other if provided in constructor.
|
104
109
|
|
105
110
|
usage: cat.getTable()
|
106
111
|
"""
|
107
112
|
# using SELECT TOP N below to workarround astroquery.utils.tap BUG
|
108
113
|
|
114
|
+
if not ( self.updated or forceUpdate or self.lastTable is None ):
|
115
|
+
return self.lastTable
|
116
|
+
|
109
117
|
clauses = []
|
110
118
|
if self.joins :
|
111
119
|
joinedCatalogNames = []
|
@@ -136,7 +144,9 @@ class Catalog():
|
|
136
144
|
|
137
145
|
query = " ".join(clauses)
|
138
146
|
logger.info(f"Querying remote catalog : {query}")
|
139
|
-
|
147
|
+
self.lastTable = self.tap.search(query,maxrec=maxrec).to_table()
|
148
|
+
self.updated=False
|
149
|
+
return self.lastTable
|
140
150
|
|
141
151
|
def tableToDict(self, table):
|
142
152
|
""" Convert table (astropy.table or row) to a list of dict so we can modify content and update remote catalog using updateRows().
|
@@ -166,6 +176,7 @@ class Catalog():
|
|
166
176
|
|
167
177
|
usage: cat.updateRows(42, {"col_a":"a", "col_b":"b" })
|
168
178
|
"""
|
179
|
+
self.updated = True
|
169
180
|
return self.api._put(f"/{self.catalogName}/{id}", values)
|
170
181
|
|
171
182
|
def updateRows(self, values):
|
@@ -174,7 +185,7 @@ class Catalog():
|
|
174
185
|
|
175
186
|
usage: updateRows([ { "id":42, "col_a":"a" }, { "id":24, "col_b":"b" } ])
|
176
187
|
"""
|
177
|
-
|
188
|
+
self.updated = True
|
178
189
|
# We may check befere sending payload that we always provide an id for every record
|
179
190
|
# What is the behaviour if we provide various data assosiated to the same id ?
|
180
191
|
return self.api._put(f"/{self.catalogName}", values)
|
@@ -185,6 +196,7 @@ class Catalog():
|
|
185
196
|
|
186
197
|
usage: addCatalogRows([ { "id":42, "col_a":"a" }, { "id":24, "col_b":"b" } ])
|
187
198
|
"""
|
199
|
+
self.updated = True
|
188
200
|
return self.api._post(f"/{self.catalogName}", json=values)
|
189
201
|
|
190
202
|
|
a2p2/version.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "0.7.
|
1
|
+
__version__ = "0.7.8"
|
2
2
|
|
3
3
|
__release_notes__ = {
|
4
4
|
# "0.1.6": {
|
@@ -23,7 +23,15 @@ __release_notes__ = {
|
|
23
23
|
# "Try to read OB in P2 and send them back to Aspro2 as a new obs",
|
24
24
|
# ],
|
25
25
|
|
26
|
-
"0.7.
|
26
|
+
"0.7.8": {
|
27
|
+
"A2P2": [
|
28
|
+
"catalogs : use cache for dataFrame() so we can modify it (was recreated from astropy table on each call)",
|
29
|
+
],
|
30
|
+
},"0.7.7": {
|
31
|
+
"A2P2": [
|
32
|
+
"catalogs : save some data retrieval until update or force request occurs",
|
33
|
+
],
|
34
|
+
},"0.7.6": {
|
27
35
|
"A2P2": [
|
28
36
|
"add getDataFrame() to a2p2.jmmc.Catalog to provide remote data with pandas format",
|
29
37
|
],
|
@@ -7,12 +7,12 @@ a2p2/instrument.py,sha256=JI1i8vsGu1ku_3i7my278b8y8vL5Z-SF3V8XkHPSs48,732
|
|
7
7
|
a2p2/ob.py,sha256=lcSm5eXv79K6cjp0VxvxD4sSlsBTKHGbmT85XEx74lY,6268
|
8
8
|
a2p2/samp.py,sha256=DN20lWszkuuneR1BV1MBLEyoGyN8tZWvOeC5rEVLICo,3438
|
9
9
|
a2p2/utils.py,sha256=QEA9cpc2TaqXDa4yqrFiGkCl__1wV8--rVw_A-p_HM0,23833
|
10
|
-
a2p2/version.py,sha256=
|
10
|
+
a2p2/version.py,sha256=mebJf7nf4K-TQzFhN6N5xz0DL3FogdsUD2zmdxIwzrs,12910
|
11
11
|
a2p2/chara/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
a2p2/chara/facility.py,sha256=otv0UVQVYD7dE_ENojjatjld5owgM9qRm7vsAc0jyqQ,2754
|
13
13
|
a2p2/chara/gui.py,sha256=4O8u-g-UJSeqEV9CUPNflVNWIsmH0b_xf8c9huxAivs,5119
|
14
14
|
a2p2/jmmc/__init__.py,sha256=Yx8Ae77UQA_aLMzhKgWym4m2fbMR_4m77TGfaXy6I4A,187
|
15
|
-
a2p2/jmmc/catalogs.py,sha256=
|
15
|
+
a2p2/jmmc/catalogs.py,sha256=BTfG5550GOehjouFx7J_9-Ww2S8NFjQUpEwBbSoinNQ,9199
|
16
16
|
a2p2/jmmc/generated_models.py,sha256=69fmPfkCMBc0GyDeHp1rs0vkoPqOE4j0egMBWX5mB1U,11823
|
17
17
|
a2p2/jmmc/models.py,sha256=ikI8Dk-9ThkG1uHtoPJwB43tPF_YZj8M5tftIcJio7s,3776
|
18
18
|
a2p2/jmmc/services.py,sha256=kcRaRnR4COKijF5izDqqNHjKyU1j2H8PEPvbDsBUFcw,312
|
@@ -31,9 +31,9 @@ a2p2/vlti/conf/MATISSE_ditTable.json,sha256=2RQXb9UL1_VlcAAGoxqpe3nTrRfO4gyOX_IG
|
|
31
31
|
a2p2/vlti/conf/MATISSE_rangeTable.json,sha256=_j5m-EOh4bbfwdaANdh23yjgNef95AUku_uNujr9BDc,5770
|
32
32
|
a2p2/vlti/conf/PIONIER_ditTable.json,sha256=BKK7nF0nE_LOP44l_fAvAnpG8oOq5p9srcdTNQ2udKo,857
|
33
33
|
a2p2/vlti/conf/PIONIER_rangeTable.json,sha256=71Ycm2h-uBUVSAWy6lTpaBDOYwKKL5MuZH6F5ESHOI0,2113
|
34
|
-
a2p2-0.7.
|
35
|
-
a2p2-0.7.
|
36
|
-
a2p2-0.7.
|
37
|
-
a2p2-0.7.
|
38
|
-
a2p2-0.7.
|
39
|
-
a2p2-0.7.
|
34
|
+
a2p2-0.7.8.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
35
|
+
a2p2-0.7.8.dist-info/METADATA,sha256=RU21-wyWUbs1npE-so85NC_ecHLkfHNB3XsTCVwQ2_M,4188
|
36
|
+
a2p2-0.7.8.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
37
|
+
a2p2-0.7.8.dist-info/entry_points.txt,sha256=5Pq7faxs04hSEtjpqtBAlHw3cGUpvTmBugnS5PzgJMY,44
|
38
|
+
a2p2-0.7.8.dist-info/top_level.txt,sha256=lLDb6xGRyHYSbrO0EUx8vNEzTiCDtPe2z7PSbqGY4kE,5
|
39
|
+
a2p2-0.7.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|