a2p2 0.7.6__tar.gz → 0.7.8__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 (49) hide show
  1. {a2p2-0.7.6/a2p2.egg-info → a2p2-0.7.8}/PKG-INFO +1 -1
  2. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/jmmc/catalogs.py +18 -6
  3. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/version.py +10 -2
  4. {a2p2-0.7.6 → a2p2-0.7.8/a2p2.egg-info}/PKG-INFO +1 -1
  5. {a2p2-0.7.6 → a2p2-0.7.8}/LICENSE +0 -0
  6. {a2p2-0.7.6 → a2p2-0.7.8}/MANIFEST.in +0 -0
  7. {a2p2-0.7.6 → a2p2-0.7.8}/README.rst +0 -0
  8. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/__init__.py +0 -0
  9. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/__main__.py +0 -0
  10. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/chara/__init__.py +0 -0
  11. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/chara/facility.py +0 -0
  12. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/chara/gui.py +0 -0
  13. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/client.py +0 -0
  14. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/facility.py +0 -0
  15. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/gui.py +0 -0
  16. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/instrument.py +0 -0
  17. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/jmmc/__init__.py +0 -0
  18. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/jmmc/generated_models.py +0 -0
  19. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/jmmc/models.py +0 -0
  20. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/jmmc/services.py +0 -0
  21. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/jmmc/utils.py +0 -0
  22. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/jmmc/webservices.py +0 -0
  23. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/ob.py +0 -0
  24. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/samp.py +0 -0
  25. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/utils.py +0 -0
  26. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/__init__.py +0 -0
  27. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/conf/GRAVITY_ditTable.json +0 -0
  28. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/conf/GRAVITY_rangeTable.json +0 -0
  29. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/conf/MATISSE_ditTable.json +0 -0
  30. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/conf/MATISSE_rangeTable.json +0 -0
  31. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/conf/PIONIER_ditTable.json +0 -0
  32. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/conf/PIONIER_rangeTable.json +0 -0
  33. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/facility.py +0 -0
  34. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/gravity.py +0 -0
  35. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/gui.py +0 -0
  36. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/instrument.py +0 -0
  37. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/matisse.py +0 -0
  38. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2/vlti/pionier.py +0 -0
  39. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2.egg-info/SOURCES.txt +0 -0
  40. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2.egg-info/dependency_links.txt +0 -0
  41. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2.egg-info/entry_points.txt +0 -0
  42. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2.egg-info/requires.txt +0 -0
  43. {a2p2-0.7.6 → a2p2-0.7.8}/a2p2.egg-info/top_level.txt +0 -0
  44. {a2p2-0.7.6 → a2p2-0.7.8}/pyproject.toml +0 -0
  45. {a2p2-0.7.6 → a2p2-0.7.8}/setup.cfg +0 -0
  46. {a2p2-0.7.6 → a2p2-0.7.8}/setup.py +0 -0
  47. {a2p2-0.7.6 → a2p2-0.7.8}/test/test_jmmc_catalog.py +0 -0
  48. {a2p2-0.7.6 → a2p2-0.7.8}/test/test_jmmc_models.py +0 -0
  49. {a2p2-0.7.6 → a2p2-0.7.8}/test/test_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: a2p2
3
- Version: 0.7.6
3
+ Version: 0.7.8
4
4
  Author-email: JMMC Tech Group <jmmc-tech-group@jmmc.fr>
5
5
  License: OSI Approved :: GNU General Public License v3 (GPLv3)
6
6
  Project-URL: Homepage, https://www.jmmc.fr/a2p2
@@ -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
- return self.getTable().to_pandas()
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
- return self.tap.search(query,maxrec=maxrec).to_table()
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
 
@@ -1,4 +1,4 @@
1
- __version__ = "0.7.6"
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.6": {
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
  ],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: a2p2
3
- Version: 0.7.6
3
+ Version: 0.7.8
4
4
  Author-email: JMMC Tech Group <jmmc-tech-group@jmmc.fr>
5
5
  License: OSI Approved :: GNU General Public License v3 (GPLv3)
6
6
  Project-URL: Homepage, https://www.jmmc.fr/a2p2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes