a2p2 0.7.1__tar.gz → 0.7.2__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.1/a2p2.egg-info → a2p2-0.7.2}/PKG-INFO +1 -1
  2. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/__main__.py +39 -0
  3. a2p2-0.7.2/a2p2/chara/facility.py +68 -0
  4. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/client.py +16 -3
  5. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/version.py +20 -7
  6. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/gravity.py +3 -7
  7. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/gui.py +2 -2
  8. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/instrument.py +6 -1
  9. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/matisse.py +1 -10
  10. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/pionier.py +2 -9
  11. {a2p2-0.7.1 → a2p2-0.7.2/a2p2.egg-info}/PKG-INFO +1 -1
  12. a2p2-0.7.1/a2p2/chara/facility.py +0 -63
  13. {a2p2-0.7.1 → a2p2-0.7.2}/LICENSE +0 -0
  14. {a2p2-0.7.1 → a2p2-0.7.2}/MANIFEST.in +0 -0
  15. {a2p2-0.7.1 → a2p2-0.7.2}/README.rst +0 -0
  16. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/__init__.py +0 -0
  17. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/chara/__init__.py +0 -0
  18. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/chara/gui.py +0 -0
  19. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/facility.py +0 -0
  20. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/gui.py +0 -0
  21. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/instrument.py +0 -0
  22. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/jmmc/__init__.py +0 -0
  23. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/jmmc/catalogs.py +0 -0
  24. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/jmmc/generated_models.py +0 -0
  25. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/jmmc/models.py +0 -0
  26. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/jmmc/services.py +0 -0
  27. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/jmmc/utils.py +0 -0
  28. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/jmmc/webservices.py +0 -0
  29. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/ob.py +0 -0
  30. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/samp.py +0 -0
  31. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/utils.py +0 -0
  32. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/__init__.py +0 -0
  33. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/conf/GRAVITY_ditTable.json +0 -0
  34. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/conf/GRAVITY_rangeTable.json +0 -0
  35. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/conf/MATISSE_ditTable.json +0 -0
  36. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/conf/MATISSE_rangeTable.json +0 -0
  37. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/conf/PIONIER_ditTable.json +0 -0
  38. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/conf/PIONIER_rangeTable.json +0 -0
  39. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2/vlti/facility.py +0 -0
  40. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2.egg-info/SOURCES.txt +0 -0
  41. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2.egg-info/dependency_links.txt +0 -0
  42. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2.egg-info/entry_points.txt +0 -0
  43. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2.egg-info/requires.txt +0 -0
  44. {a2p2-0.7.1 → a2p2-0.7.2}/a2p2.egg-info/top_level.txt +0 -0
  45. {a2p2-0.7.1 → a2p2-0.7.2}/setup.cfg +0 -0
  46. {a2p2-0.7.1 → a2p2-0.7.2}/setup.py +0 -0
  47. {a2p2-0.7.1 → a2p2-0.7.2}/test/test_jmmc_catalog.py +0 -0
  48. {a2p2-0.7.1 → a2p2-0.7.2}/test/test_jmmc_models.py +0 -0
  49. {a2p2-0.7.1 → a2p2-0.7.2}/test/test_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: a2p2
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: UNKNOWN
5
5
  Home-page: http://www.jmmc.fr/a2p2
6
6
  Author: JMMC Tech Group
@@ -2,7 +2,40 @@
2
2
  from __future__ import with_statement
3
3
 
4
4
  import traceback
5
+
5
6
  from argparse import ArgumentParser
7
+ from a2p2 import __release_notes__
8
+ from distutils.version import LooseVersion
9
+
10
+
11
+
12
+ def createMdReleaseNotes():
13
+ """
14
+ Present in a reverse ordered way the dictionnary version items.
15
+ """
16
+ txt = "# A2P2 release notes"
17
+ lvs = [LooseVersion(v) for v in __release_notes__]
18
+ for lv in sorted(lvs, reverse=True):
19
+ v=lv.vstring
20
+ txt += "\n## V " + v + " :"
21
+ keys = []
22
+ for k in sorted(__release_notes__[v]):
23
+ if not ("TODO" in k):
24
+ keys.append(k)
25
+ for k in sorted(__release_notes__[v]):
26
+ if "TODO" in k:
27
+ keys.append(k)
28
+
29
+ for e in keys:
30
+ infos = __release_notes__[v][e]
31
+ if infos:
32
+ txt += "\n### " + e + " : "
33
+ for i in infos:
34
+ txt += "\n- " + i
35
+ txt += "\n\n"
36
+ f=open("release-notes.md", "w")
37
+ f.write(txt)
38
+ print(f"{f.name} generated")
6
39
 
7
40
 
8
41
  def main():
@@ -14,15 +47,21 @@ def main():
14
47
  help='fake API to avoid remote connection (dev. only).')
15
48
  parser.add_argument('-v', '--verbose', action='store_true', help='Verbose')
16
49
  parser.add_argument('-c', '--createprefs', action='store_true', help='Create preferences file')
50
+ parser.add_argument('-r', '--releasenotes', action='store_true', help='Create md release notes file')
17
51
 
18
52
  args = parser.parse_args()
19
53
 
20
54
  from . import A2p2Client
21
55
 
56
+ if args.releasenotes:
57
+ createMdReleaseNotes()
58
+ exit()
59
+
22
60
  if args.createprefs:
23
61
  A2p2Client.createPreferencesFile()
24
62
  exit()
25
63
 
64
+
26
65
  try:
27
66
  with A2p2Client(args.fakeapi, args.verbose) as a2p2c:
28
67
  # if args.config:
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env python
2
+
3
+ __all__ = []
4
+
5
+ from a2p2.chara.gui import CharaUI
6
+ from a2p2.facility import Facility
7
+ import requests
8
+ import logging
9
+ import traceback
10
+
11
+ HELPTEXT = "TODO update this HELP message in a2p2/chara/facility.py"
12
+
13
+ logger = logging.getLogger(__name__)
14
+
15
+ class CharaFacility(Facility):
16
+
17
+ def __init__(self, a2p2client):
18
+ Facility.__init__(self, a2p2client, "CHARA", HELPTEXT)
19
+ self.charaUI = CharaUI(self)
20
+ self.connected2OB2 = False
21
+
22
+ def processOB(self, ob):
23
+ if not ob:
24
+ return
25
+
26
+ self.a2p2client.ui.addToLog(
27
+ "OB received for '" + self.facilityName + "' interferometer")
28
+ # show ob dict for debug
29
+ self.a2p2client.ui.addToLog(str(ob), False)
30
+
31
+ # performs operation
32
+ self.consumeOB(ob)
33
+
34
+ # give focus on last updated UI
35
+ self.a2p2client.ui.showFacilityUI(self.charaUI)
36
+
37
+ def consumeOB(self, ob):
38
+ # forward message if a server is present in the preferences
39
+ queueServers=self.a2p2client.preferences.getCharaQueueServer()
40
+ if queueServers :
41
+ for queueServer in queueServers:
42
+ logger.debug(f'Trying to send OB on queuserver : {queueServer}')
43
+ try:
44
+ if not self.connected2OB2:
45
+ try:
46
+ c=requests.get(queueServer, timeout=5)
47
+ msg += f"Connection succeeded on OB2 server : {c.json()}\n"
48
+ except:
49
+ msg += f"Connection succeded on a non identified OB2 server\n"
50
+ r = requests.post(queueServer, json=ob.as_dict(), timeout=5)
51
+ msg = ""
52
+ msg+=f"OB sent to remote server queue : {r}"
53
+ self.connected2OB2 = True
54
+ self.a2p2client.ui.addToLog(msg)
55
+ self.charaUI.display(msg)
56
+ break # do only send to the first server
57
+ except:
58
+ print(traceback.format_exc())
59
+ msg=f"Can't send OB to the '{queueServer}' queue server, please launch it, edit your preferences or check your ssh port forwarding "
60
+ self.connected2OB2 = False
61
+ self.a2p2client.ui.addToLog(msg)
62
+ self.charaUI.display(msg)
63
+
64
+
65
+ # display OB
66
+ self.charaUI.displayOB(ob)
67
+
68
+
@@ -59,7 +59,9 @@ class A2p2Client():
59
59
  self.facilityManager = FacilityManager(self)
60
60
 
61
61
  if self.preferences.exists():
62
- pass
62
+ A2P2ClientPreferences.updatePreferencesFile()
63
+ self.ui.addToLog(
64
+ f"Using preference from '{A2P2ClientPreferences.getPreferencesFileName()}'.\n")
63
65
  else:
64
66
  self.ui.addToLog(
65
67
  "No preference file found, please create one so your data persists (launch program with -c option).\n")
@@ -236,6 +238,15 @@ class A2P2ClientPreferences():
236
238
  preferences_file = os.path.join(user_config_dir(
237
239
  A2P2ClientPreferences.appname), "prefs.ini")
238
240
  return preferences_file
241
+ def updatePreferencesFile():
242
+ return
243
+ # TODO
244
+ # we suppose the file exists
245
+ filename = A2P2ClientPreferences.getPreferencesFileName()
246
+ buffer=""
247
+ for line in open(filename):
248
+ buffer+=line+"\n"
249
+ print (buffer)
239
250
 
240
251
  def createPreferencesFile():
241
252
  filename = A2P2ClientPreferences.getPreferencesFileName()
@@ -270,7 +281,7 @@ class A2P2ClientPreferences():
270
281
  s['# CHARA SECTION'] = ""
271
282
  s['# = > please uncomment and update next properties to make it active <'] = ""
272
283
  s['# = > queueserver may be uncommented to forward OB to a remote server instead <'] = ""
273
- s['#queueserver'] = "http://localhost:2468/test"
284
+ s['#queueserver'] = 'http://192.168.3.153:2468/test,http://localhost:2468/test'
274
285
 
275
286
  config['p2'] = {}
276
287
  s=config['p2']
@@ -329,7 +340,9 @@ class A2P2ClientPreferences():
329
340
 
330
341
  # Retrieve CHARA prefs
331
342
  def getCharaQueueServer(self):
332
- return self.getConfig("chara", "queueserver", None)
343
+ s = self.getConfig("chara", "queueserver", None)
344
+ if s:
345
+ return s.split(",")
333
346
 
334
347
 
335
348
  # Retrieve P2 prefs
@@ -1,4 +1,4 @@
1
- __version__ = "0.7.1"
1
+ __version__ = "0.7.2"
2
2
 
3
3
  __release_notes__ = {
4
4
  # "0.1.6": {
@@ -21,19 +21,18 @@ __release_notes__ = {
21
21
  #
22
22
  # ],
23
23
  # },
24
- "0.7.1": {
24
+ "0.7.2": {
25
25
  "STATUS": [
26
26
  ],
27
27
  "A2P2": [
28
- "Fix ttk import on MacOS",
28
+ "Auto update chara queueserver preference",
29
+ "a2p2 -r generates release-notes.md (rendered on a2p2 repository)"
29
30
  ],
30
31
  "VLTI": [
31
- "Add first P112 support using radiobutton to select proper onaxis offaxis or wide GRAVITY templates",
32
- "Improve coordinate's checks and computations",
33
- "Add FT's propermotions and parallax"
32
+ "Bugfix to support missin preference file"
34
33
  ],
35
34
  "CHARA": [
36
- "Display log of received OB also for calibrators"
35
+ "Support and try every queueserver's Urls comma separated from the queuserver user preference"
37
36
  ],
38
37
  "TODO-SCIENCE": [
39
38
  "Merge AO or GS in a same code section for every instruments",
@@ -47,6 +46,20 @@ __release_notes__ = {
47
46
  "Complete test suite with more real p2 submissions",
48
47
  "Try to read OB in P2 and send them back to Aspro2 as a new obs",
49
48
  ],
49
+ },"0.7.1": {
50
+ "STATUS": [
51
+ ],
52
+ "A2P2": [
53
+ "Fix ttk import on MacOS",
54
+ ],
55
+ "VLTI": [
56
+ "Add first P112 support using radiobutton to select proper onaxis offaxis or wide GRAVITY templates",
57
+ "Improve coordinate's checks and computations",
58
+ "Add FT's propermotions and parallax"
59
+ ],
60
+ "CHARA": [
61
+ "Display log of received OB also for calibrators"
62
+ ]
50
63
  },"0.6.9": {
51
64
  "STATUS": [
52
65
  ],
@@ -73,7 +73,6 @@ class Gravity(VltiInstrument):
73
73
  obsTSF = TSF(self, self.getGravityObsTemplateName(
74
74
  ob, OBJTYPE, dualField))
75
75
 
76
- obTarget = OBTarget()
77
76
  obConstraints = OBConstraints(self)
78
77
 
79
78
  # Check SPEC_RES from instrumentMode and set SPEC_POL except for single_offaxis ( missing keyword INS_SPEC_RES)
@@ -93,13 +92,10 @@ class Gravity(VltiInstrument):
93
92
 
94
93
  scienceTarget = observationConfiguration.SCTarget
95
94
 
95
+ obTarget = OBTarget(self, scienceTarget)
96
+
96
97
  # define target
97
- acqTSF.SEQ_INS_SOBJ_NAME = scienceTarget.name.strip().replace(
98
- ' ', '_') # allowed characters: letters, digits, + - _ . and no spaces
99
- obTarget.name = acqTSF.SEQ_INS_SOBJ_NAME
100
- obTarget.ra, obTarget.dec = self.getCoords(scienceTarget)
101
- obTarget.properMotionRa, obTarget.properMotionDec = self.getPMCoords(
102
- scienceTarget)
98
+ acqTSF.SEQ_INS_SOBJ_NAME = obTarget.name
103
99
 
104
100
  # Set baseline interferometric array code (should be a keywordlist)
105
101
  acqTSF.ISS_BASELINE = [self.getBaselineCode(ob)]
@@ -229,8 +229,8 @@ class TreeFrame(Frame):
229
229
  for isvt in self.vltiUI.facility.getIssVltiTypes():
230
230
  boolv = BooleanVar()
231
231
  self.issVltiTypeCheckboxesVars[isvt]=boolv
232
- boolv.set( isvt in pvltitypes or len(pvltitypes)==0 )
233
- logger.debug(f"Set prefrence value for {isvt} : {boolv.get()}")
232
+ boolv.set( not pvltitypes or len(pvltitypes)==0 or isvt in pvltitypes )
233
+ logger.debug(f"Set preference value for {isvt} : {boolv.get()}")
234
234
  cb = Checkbutton(buttonframe, text=isvt, variable=boolv, onvalue=True, offvalue=False)
235
235
  cb.grid(row=0, column=cindex)
236
236
  cindex += 1
@@ -700,9 +700,14 @@ class FixedDict(object):
700
700
 
701
701
  class OBTarget(FixedDict):
702
702
 
703
- def __init__(self):
703
+ def __init__(self, instrument, scienceTarget):
704
704
  FixedDict.__init__(
705
705
  self, ('name', 'ra', 'dec', 'properMotionRa', 'properMotionDec'))
706
+ # Target name can include any alphanumeric character, and space, dot, plus or minus signs [a-z][A-Z][0-9][.+- ]
707
+ # ( https://www.eso.org/sci/observing/phase2/p2intro/p2-tutorials/p2-ImportTargetList.html )
708
+ self.name = re.sub(r'[^a-zA-Z0-9.\+\- ]+','',scienceTarget.name.strip())
709
+ self.ra, self.dec = instrument.getCoords(scienceTarget)
710
+ self.properMotionRa, self.properMotionDec = instrument.getPMCoords(scienceTarget)
706
711
 
707
712
 
708
713
  class OBConstraints(TSF):
@@ -48,7 +48,6 @@ class Matisse(VltiInstrument):
48
48
  acqTSF = TSF(self, f"MATISSE_img_acq{tsfSuffix}.tsf") # or .tsfx?
49
49
  obsTSF = TSF(self, f"MATISSE_hyb_obs{tsfSuffix}.tsf")
50
50
 
51
- obTarget = OBTarget()
52
51
  obConstraints = OBConstraints(self)
53
52
 
54
53
  if 'SCIENCE' in observationConfiguration.type:
@@ -57,15 +56,7 @@ class Matisse(VltiInstrument):
57
56
  obsTSF.DPR_CATG = 'CALIB'
58
57
 
59
58
  scienceTarget = observationConfiguration.SCTarget
60
-
61
- # define target
62
-
63
- obTarget.name = scienceTarget.name.replace(' ',
64
- '_') # allowed characters: letters, digits, + - _ . and no spaces
65
- # allowed characters: letters, digits, + - _ . and no spaces
66
- obTarget.ra, obTarget.dec = self.getCoords(scienceTarget)
67
- obTarget.properMotionRa, obTarget.properMotionDec = self.getPMCoords(
68
- scienceTarget)
59
+ obTarget = OBTarget(self, scienceTarget)
69
60
 
70
61
  # Set baseline interferometric array code (should be a keywordlist)
71
62
  acqTSF.ISS_BASELINE = [self.getBaselineCode(ob)]
@@ -48,7 +48,7 @@ class Pionier(VltiInstrument):
48
48
  kappaTSF = TSF(self, "PIONIER_gen_cal_kappa.tsf")
49
49
  darkTSF = TSF(self, "PIONIER_gen_cal_dark.tsf")
50
50
 
51
- obTarget = OBTarget()
51
+
52
52
  obConstraints = OBConstraints(self)
53
53
 
54
54
  # set common properties
@@ -63,14 +63,7 @@ class Pionier(VltiInstrument):
63
63
 
64
64
  scienceTarget = observationConfiguration.SCTarget
65
65
 
66
- # define target
67
- # acqTSF.SEQ_INS_SOBJ_NAME = scienceTarget.name.strip()
68
-
69
- obTarget.name = scienceTarget.name.strip().replace(
70
- ' ', '_') # allowed characters: letters, digits, + - _ . and no spaces
71
- obTarget.ra, obTarget.dec = self.getCoords(scienceTarget)
72
- obTarget.properMotionRa, obTarget.properMotionDec = self.getPMCoords(
73
- scienceTarget)
66
+ obTarget = OBTarget(self, scienceTarget)
74
67
 
75
68
  # Set baseline interferometric array code (should be a keywordlist)
76
69
  acqTSF.ISS_BASELINE = [self.getBaselineCode(ob)]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: a2p2
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: UNKNOWN
5
5
  Home-page: http://www.jmmc.fr/a2p2
6
6
  Author: JMMC Tech Group
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- __all__ = []
4
-
5
- from a2p2.chara.gui import CharaUI
6
- from a2p2.facility import Facility
7
- import requests
8
- import logging
9
- import traceback
10
-
11
- HELPTEXT = "TODO update this HELP message in a2p2/chara/facility.py"
12
-
13
- logger = logging.getLogger(__name__)
14
-
15
- class CharaFacility(Facility):
16
-
17
- def __init__(self, a2p2client):
18
- Facility.__init__(self, a2p2client, "CHARA", HELPTEXT)
19
- self.charaUI = CharaUI(self)
20
- self.connected2OB2 = False
21
-
22
- def processOB(self, ob):
23
- if not ob:
24
- return
25
-
26
- self.a2p2client.ui.addToLog(
27
- "OB received for '" + self.facilityName + "' interferometer")
28
- # show ob dict for debug
29
- self.a2p2client.ui.addToLog(str(ob), False)
30
-
31
- # performs operation
32
- self.consumeOB(ob)
33
-
34
- # give focus on last updated UI
35
- self.a2p2client.ui.showFacilityUI(self.charaUI)
36
-
37
- def consumeOB(self, ob):
38
- # forward message if a server is present in the preferences
39
- charaServer=self.a2p2client.preferences.getCharaQueueServer()
40
- if charaServer :
41
- try:
42
- r = requests.post(charaServer, json=ob.as_dict())
43
- msg = ""
44
- if not self.connected2OB2:
45
- try:
46
- c=requests.get(charaServer)
47
- msg += f"Connection succeeded on OB2 server : {c.json()}\n"
48
- except:
49
- msg += f"Connection succeded on a non identified OB2 server\n"
50
- msg+=f"OB sent to remote server queue : {r}"
51
- self.connected2OB2 = True
52
- except:
53
- print(traceback.format_exc())
54
- msg=f"Can't send OB to the queue server, please launch it or check your ssh port forwarding ( {charaServer} )"
55
- self.connected2OB2 = False
56
-
57
- self.a2p2client.ui.addToLog(msg)
58
- self.charaUI.display(msg)
59
-
60
- # display OB
61
- self.charaUI.displayOB(ob)
62
-
63
-
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