sparclclient 1.2.6b12__py2.py3-none-any.whl → 1.2.7b1__py2.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.
sparcl/__init__.py CHANGED
@@ -35,4 +35,5 @@ __all__ = ["client", "align_records"]
35
35
  #__version__ = "1.2.3"
36
36
  #__version__ = "1.2.4"
37
37
  #__version__ = "1.2.5"
38
- __version__ = "1.2.6b12"
38
+ #__version__ = "1.2.6"
39
+ __version__ = "1.2.7b1"
sparcl/client.py CHANGED
@@ -163,7 +163,7 @@ class SparclClient: # was SparclApi()
163
163
  Defaults to True.
164
164
 
165
165
  Example:
166
- >>> client = SparclClient()
166
+ >>> client = SparclClient(announcement=False)
167
167
 
168
168
  Raises:
169
169
  Exception: Object creation compares the version from the
@@ -197,8 +197,10 @@ class SparclClient: # was SparclApi()
197
197
  self.verbose = verbose
198
198
  self.show_curl = show_curl # Show CURL equivalent of client method
199
199
  #!self.internal_names = internal_names
200
- self.c_timeout = min(MAX_CONNECT_TIMEOUT, float(connect_timeout)) # seconds
201
- self.r_timeout = min(MAX_READ_TIMEOUT, float(read_timeout)) # seconds
200
+ self.c_timeout = min(MAX_CONNECT_TIMEOUT,
201
+ float(connect_timeout)) # seconds
202
+ self.r_timeout = min(MAX_READ_TIMEOUT,
203
+ float(read_timeout)) # seconds
202
204
 
203
205
  # require response within this num seconds
204
206
  # https://2.python-requests.org/en/master/user/advanced/#timeouts
@@ -213,7 +215,7 @@ class SparclClient: # was SparclApi()
213
215
  if announcement:
214
216
  ann = f"{self.apiurl}/announcement/"
215
217
  annres = requests.get(ann, timeout=self.timeout)
216
- annstr = annres.json()['announcement']
218
+ annstr = annres.json()["announcement"]
217
219
  if annstr:
218
220
  print(f"announcement={annstr}")
219
221
 
@@ -307,7 +309,7 @@ class SparclClient: # was SparclApi()
307
309
 
308
310
  Example:
309
311
  >>>
310
- >> client = SparclClient()
312
+ >> client = SparclClient(announcement=False)
311
313
  >> client.login('test_user@noirlab.edu', 'testpw')
312
314
  Logged in successfully with email='test_user@noirlab.edu'
313
315
  """
@@ -342,7 +344,8 @@ class SparclClient: # was SparclApi()
342
344
  self.renew_token = None
343
345
  self.token_exp = None
344
346
  msg = (
345
- 'Could not login with given credentials. Reverted to "Anonymous" user.'
347
+ 'Could not login with given credentials. Reverted '
348
+ 'to "Anonymous" user.'
346
349
  )
347
350
  return msg
348
351
 
@@ -370,7 +373,7 @@ class SparclClient: # was SparclApi()
370
373
  None.
371
374
 
372
375
  Example:
373
- >>> client = SparclClient()
376
+ >>> client = SparclClient(announcement=False)
374
377
  >>> client.logout()
375
378
  Logged-out successfully. Previously logged-in with email None.
376
379
  """
@@ -419,7 +422,7 @@ class SparclClient: # was SparclApi()
419
422
  List of fields tagged as 'default' from DATASET_LIST.
420
423
 
421
424
  Example:
422
- >>> client = SparclClient()
425
+ >>> client = SparclClient(announcement=False)
423
426
  >>> client.get_default_fields()
424
427
  ['dec', 'flux', 'ra', 'sparcl_id', 'specid', 'wavelength']
425
428
  """
@@ -450,7 +453,7 @@ class SparclClient: # was SparclApi()
450
453
  List of fields tagged as 'all' from DATASET_LIST.
451
454
 
452
455
  Example:
453
- >>> client = SparclClient()
456
+ >>> client = SparclClient(announcement=False)
454
457
  >>> client.get_all_fields()
455
458
  ['data_release', 'datasetgroup', 'dateobs', 'dateobs_center', 'dec', 'exptime', 'flux', 'instrument', 'ivar', 'mask', 'model', 'ra', 'redshift', 'redshift_err', 'redshift_warning', 'site', 'sparcl_id', 'specid', 'specprimary', 'spectype', 'survey', 'targetid', 'telescope', 'wave_sigma', 'wavelength', 'wavemax', 'wavemin']
456
459
  """ # noqa: E501
@@ -477,7 +480,8 @@ class SparclClient: # was SparclApi()
477
480
  return True
478
481
 
479
482
  def _common_internal(self, *, science_fields=None, dataset_list=None):
480
- self._validate_science_fields(science_fields, dataset_list=dataset_list)
483
+ self._validate_science_fields(science_fields,
484
+ dataset_list=dataset_list)
481
485
 
482
486
  if dataset_list is None:
483
487
  dataset_list = self.fields.all_drs
@@ -506,7 +510,7 @@ class SparclClient: # was SparclApi()
506
510
  Set of fields available from data sets in DATASET_LIST.
507
511
 
508
512
  Example:
509
- >>> client = SparclClient()
513
+ >>> client = SparclClient(announcement=False)
510
514
  >>> sorted(client.get_available_fields())
511
515
  ['data_release', 'datasetgroup', 'dateobs', 'dateobs_center', 'dec', 'exptime', 'extra_files', 'file', 'flux', 'instrument', 'ivar', 'mask', 'model', 'ra', 'redshift', 'redshift_err', 'redshift_warning', 'site', 'sparcl_id', 'specid', 'specprimary', 'spectype', 'survey', 'targetid', 'telescope', 'updated', 'wave_sigma', 'wavelength', 'wavemax', 'wavemin']
512
516
 
@@ -526,7 +530,7 @@ class SparclClient: # was SparclApi()
526
530
  API version (:obj:`float`).
527
531
 
528
532
  Example:
529
- >>> client = SparclClient()
533
+ >>> client = SparclClient(announcement=False)
530
534
  >>> client.version
531
535
  12.0
532
536
  """
@@ -579,7 +583,7 @@ class SparclClient: # was SparclApi()
579
583
  :class:`~sparcl.Results.Found`: Contains header and records.
580
584
 
581
585
  Example:
582
- >>> client = SparclClient()
586
+ >>> client = SparclClient(announcement=False)
583
587
  >>> outs = ['sparcl_id', 'ra', 'dec']
584
588
  >>> cons = {'spectype': ['GALAXY'], 'redshift': [0.5, 0.9]}
585
589
  >>> found = client.find(outfields=outs, constraints=cons)
@@ -601,9 +605,10 @@ class SparclClient: # was SparclApi()
601
605
  #! dataset_list=dataset_list) # DLS-401
602
606
  dr = list(dataset_list)[0]
603
607
  if len(constraints) > 0:
604
- self._validate_science_fields(constraints.keys(), dataset_list=dataset_list)
608
+ self._validate_science_fields(constraints.keys(),
609
+ dataset_list=dataset_list)
605
610
  constraints = {
606
- self.fields._internal_name(k, dr): v for k, v in constraints.items()
611
+ self.fields._internal_name(k, dr): v for k, v in constraints.items() # noqa: E501
607
612
  }
608
613
  uparams = dict(
609
614
  limit=limit,
@@ -637,7 +642,14 @@ class SparclClient: # was SparclApi()
637
642
  print(f"Record key counts: {ut.count_values(found.records)}")
638
643
  return found
639
644
 
640
- def missing(self, uuid_list, *, dataset_list=None, countOnly=False, verbose=False):
645
+ def missing(
646
+ self,
647
+ uuid_list,
648
+ *,
649
+ dataset_list=None,
650
+ countOnly=False,
651
+ verbose=False
652
+ ):
641
653
  """Return the subset of sparcl_ids in the given uuid_list that are
642
654
  NOT stored in the SPARCL database.
643
655
 
@@ -660,7 +672,7 @@ class SparclClient: # was SparclApi()
660
672
  are NOT stored in the SPARCL database.
661
673
 
662
674
  Example:
663
- >>> client = SparclClient()
675
+ >>> client = SparclClient(announcement=False)
664
676
  >>> ids = ['ddbb57ee-8e90-4a0d-823b-0f5d97028076',]
665
677
  >>> client.missing(ids)
666
678
  ['ddbb57ee-8e90-4a0d-823b-0f5d97028076']
@@ -715,11 +727,11 @@ class SparclClient: # was SparclApi()
715
727
  are NOT stored in the SPARCL database.
716
728
 
717
729
  Example:
718
- >>> client = SparclClient()
730
+ >>> client = SparclClient(announcement=False)
719
731
  >>> found = client.find(outfields=['specid'], limit=2)
720
732
  >>> specids = [f.specid for f in found.records]
721
- >>> client.missing_specids(specids + ['bad_id'])
722
- ['bad_id']
733
+ >>> client.missing_specids(specids + ['6802933904984788992'])
734
+ ['6802933904984788992']
723
735
  """
724
736
  if dataset_list is None:
725
737
  dataset_list = self.fields.all_drs
@@ -805,7 +817,7 @@ class SparclClient: # was SparclApi()
805
817
  :class:`~sparcl.Results.Retrieved`: Contains header and records.
806
818
 
807
819
  Example:
808
- >>> client = SparclClient()
820
+ >>> client = SparclClient(announcement=False)
809
821
  >>> ids = client.find(limit=1).ids
810
822
  >>> inc = ['sparcl_id', 'flux', 'wavelength', 'model']
811
823
  >>> ret = client.retrieve(uuid_list=ids, include=inc)
@@ -1008,7 +1020,7 @@ class SparclClient: # was SparclApi()
1008
1020
  :class:`~sparcl.Results.Retrieved`: Contains header and records.
1009
1021
 
1010
1022
  Example:
1011
- >>> client = SparclClient()
1023
+ >>> client = SparclClient(announcement=False)
1012
1024
  >>> sids = [5840097619402313728, -8985592895187431424]
1013
1025
  >>> inc = ['specid', 'flux', 'wavelength', 'model']
1014
1026
  >>> ret = client.retrieve_by_specid(specid_list=sids, include=inc)
sparcl/gather_2d.py CHANGED
@@ -39,9 +39,7 @@ def _wavelength_offsets(records):
39
39
  set(records[0].wavelength).union(*[r.wavelength for r in records[1:]])
40
40
  )
41
41
  # offsets[ri] = index into WINDOW
42
- offsets = {
43
- ri: window.index(rec.wavelength[0]) for ri, rec in enumerate(records)
44
- }
42
+ offsets = {ri: window.index(rec.wavelength[0]) for ri, rec in enumerate(records)} # noqa: E501
45
43
  return (window, offsets)
46
44
 
47
45
 
@@ -89,7 +87,7 @@ def _align_wavelengths(records):
89
87
 
90
88
 
91
89
  def _tt1(numrecs=20, dr="BOSS-DR16"):
92
- client = sparcl.client.SparclClient()
90
+ client = sparcl.client.SparclClient(announcement=False)
93
91
  found = client.find(constraints=dict(data_release=[dr]), limit=numrecs)
94
92
  got = client.retrieve(found.ids)
95
93
  records = got.records
@@ -188,7 +186,7 @@ def align_records(records, fields=["flux", "wavelength"], precision=7):
188
186
  - grid(ndarray): 1D numpy array containing wavelength values.
189
187
 
190
188
  Example:
191
- >>> client = sparcl.client.SparclClient()
189
+ >>> client = sparcl.client.SparclClient(announcement=False)
192
190
  >>> specflds = ['wavelength', 'model']
193
191
  >>> cons = {"data_release": ['BOSS-DR16']}
194
192
  >>> found = client.find(constraints=cons, limit=21)
@@ -32,10 +32,9 @@ def _resample_flux(records, wavstep=1):
32
32
 
33
33
 
34
34
  def _tt0(numrecs=20):
35
- client = sparcl.client.SparclClient()
36
- found = client.find(
37
- constraints=dict(data_release=["BOSS-DR16"]), limit=numrecs
38
- )
35
+ client = sparcl.client.SparclClient(announcement=False)
36
+ found = client.find(constraints=dict(data_release=["BOSS-DR16"]),
37
+ limit=numrecs)
39
38
  got = client.retrieve(found.ids)
40
39
  flux_2d, new_wavs = _resample_flux(got.records)
41
40
  return flux_2d, new_wavs
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sparclclient
3
- Version: 1.2.6b12
3
+ Version: 1.2.7b1
4
4
  Summary: A client for getting spectra and meta-data from NOIRLab.
5
5
  Author-email: "S. Pothier" <datalab-spectro@noirlab.edu>
6
6
  Description-Content-Type: text/markdown
@@ -1,11 +1,11 @@
1
1
  sparcl/Results.py,sha256=vnACjm8sp7MrsJ_5LTuKMuyRWqeBJxOxQM302cHmAlk,9159
2
- sparcl/__init__.py,sha256=2018vArwaDBLkVpm-c1vRFZTibYOsBP_vB_RewPX9G8,1125
3
- sparcl/client.py,sha256=COQfkDXJhmJQFJhLqiXkay847wJ3H5xSp-H6gKFP3Sc,39548
2
+ sparcl/__init__.py,sha256=Q1yzegsPH1nPWbN9a9AlmYJQMgZtmf-Ymt-FZ5uh1I0,1147
3
+ sparcl/client.py,sha256=Kv4wPUNIwAsRkzA0CMgCndKByKf9uyWaXfIyyC4RTqA,40015
4
4
  sparcl/conf.py,sha256=GFNDelaiVIAkjNjvFlG7HAlPpU39nqZmTPohQGmOcgI,928
5
5
  sparcl/exceptions.py,sha256=sznmOMGENHvxutSXlRVWqi87bR2Qiebka7LyR3mAII0,4244
6
6
  sparcl/fields.py,sha256=NZUBqDidpbXfeX5F4b306F323xZY2CRIx8eVv-HWTVU,5127
7
- sparcl/gather_2d.py,sha256=r_ZXinXlr3bOOwHrNBSWvtKC4-Dohv4nYA3iEiT1_G8,8686
8
- sparcl/resample_spectra.py,sha256=Z_Lkoq4LapaIQp7tqZ88LayRLE8o9c832Icc0jSr5ok,1282
7
+ sparcl/gather_2d.py,sha256=YTFVQl38dRZjUu0AEUFVZtQm7zC8mU3LVvUTDGxp6u8,8722
8
+ sparcl/resample_spectra.py,sha256=nk5HiyaGF-b9SiTmIC9yJBbYX4VYsiLFHyW186bPs2s,1310
9
9
  sparcl/sparc.ini,sha256=q_wjo9DLnCYRxWFMl0CtMYp4DD1AXfEcK6BP6cmncwo,329
10
10
  sparcl/type_conversion.py,sha256=QmXNX9j_7QHnBu83f2ZBfREoql9wuo98ZbhQtSjRRWc,12965
11
11
  sparcl/unsupported.py,sha256=bfkkZa-PuqwN-Bqo3vCIrLupbWMDTCiTHPMNfXnqmMc,1848
@@ -15,7 +15,7 @@ sparcl/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
15
15
  sparcl/benchmarks/benchmarks.py,sha256=OmlSdnAPLmcvGXsr-HzGyfAAcnoqlO0JQ4EIA7JGhZc,9424
16
16
  sparcl/benchmarks/sparcl_benchmarking.ipynb,sha256=gwof2hqM9Qb49qzRX-mky7WNqXZCMSB7ry8bX8dImxc,17559
17
17
  sparcl/notebooks/sparcl-examples.ipynb,sha256=gEwMKI1x7A1YsVeCsQn1QoMO0ZuIhMUAu3qedTiQ7hM,169268
18
- sparclclient-1.2.6b12.dist-info/LICENSE,sha256=y10EluGMCzGs9X4oYCYyix3l6u-lawB_vlGR8qe442Q,1576
19
- sparclclient-1.2.6b12.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
20
- sparclclient-1.2.6b12.dist-info/METADATA,sha256=9ggofEWi0wCYXNZEgirJCWhMFWSZG_wAYqDRczSjf5M,681
21
- sparclclient-1.2.6b12.dist-info/RECORD,,
18
+ sparclclient-1.2.7b1.dist-info/LICENSE,sha256=y10EluGMCzGs9X4oYCYyix3l6u-lawB_vlGR8qe442Q,1576
19
+ sparclclient-1.2.7b1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
20
+ sparclclient-1.2.7b1.dist-info/METADATA,sha256=PGbwbr4YpUV0GyMIG79I7kkFUtiniEHNo_tx1gt5OvA,680
21
+ sparclclient-1.2.7b1.dist-info/RECORD,,