arvi 0.1.29__py3-none-any.whl → 0.1.30__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.

Potentially problematic release.


This version of arvi might be problematic. Click here for more details.

arvi/dace_wrapper.py CHANGED
@@ -15,6 +15,7 @@ def load_spectroscopy(user=None) -> SpectroscopyClass:
15
15
  from .config import config
16
16
  # requesting as public
17
17
  if config.request_as_public:
18
+ logger.warning('requesting DACE data as public')
18
19
  with all_logging_disabled():
19
20
  dace = DaceClass(dace_rc_config_path='none')
20
21
  return SpectroscopyClass(dace_instance=dace)
@@ -300,26 +301,54 @@ def get_observations(star, instrument=None, user=None, main_id=None, verbose=Tru
300
301
  msg = f'no {instrument} observations for {star}'
301
302
  raise ValueError(msg)
302
303
 
303
- # sort pipelines, being extra careful with HARPS pipeline names
304
- # (i.e. ensure that 3.x.x > 3.5)
304
+ # # sort pipelines, being extra careful with HARPS pipeline names
305
+ # # (i.e. ensure that 3.x.x > 3.5)
306
+ # from re import match
307
+ # def cmp(a, b):
308
+ # if a[0] in ('3.5', '3.5 EGGS') or 'EGGS' in a[0] and match(r'3.\d.\d', b[0]):
309
+ # return -1
310
+ # if b[0] in ('3.5', '3.5 EGGS') or 'EGGS' in b[0] and match(r'3.\d.\d', a[0]):
311
+ # return 1
312
+
313
+ # if a[0] == b[0]:
314
+ # return 0
315
+ # elif a[0] > b[0]:
316
+ # return 1
317
+ # else:
318
+ # return -1
319
+
320
+ # sort pipelines, must be extra careful with HARPS/HARPN pipeline version numbers
321
+ # got here with the help of DeepSeek
305
322
  from re import match
306
- def cmp(a, b):
307
- if a[0] in ('3.5', '3.5 EGGS') or 'EGGS' in a[0] and match(r'3.\d.\d', b[0]):
308
- return -1
309
- if b[0] in ('3.5', '3.5 EGGS') or 'EGGS' in b[0] and match(r'3.\d.\d', a[0]):
310
- return 1
311
-
312
- if a[0] == b[0]:
313
- return 0
314
- elif a[0] > b[0]:
315
- return 1
316
- else:
317
- return -1
318
-
319
- from functools import cmp_to_key
323
+ def custom_sort_key(s):
324
+ s = s[0]
325
+ print(s)
326
+ # Check for version number pattern (e.g., 3.2.5 or 3.2.5-EGGS)
327
+ version_match = match(r'^(\d+(?:\.\d+)*)(?:-(.*))?$', s)
328
+ if version_match:
329
+ version_parts = tuple(map(int, version_match.group(1).split('.')))
330
+ suffix = version_match.group(2)
331
+
332
+ if suffix is not None:
333
+ # Suffixed versions: sort in ascending order (3.2.5-HR11 < 3.3.1-HR11)
334
+ return (0, 0, version_parts, suffix)
335
+ else:
336
+ # Unsuffixed versions: sort in descending order (3.5 > 3.2.5)
337
+ return (0, 1, tuple(-x for x in version_parts))
338
+
339
+ # Check for scientific reference pattern (e.g., 2004A&A...)
340
+ year_match = match(r'^(\d{4})', s)
341
+ if year_match:
342
+ year = int(year_match.group(1))
343
+ return (1, year)
344
+
345
+ # For all other strings, sort alphabetically
346
+ return (2, s)
347
+
348
+ # from functools import cmp_to_key
320
349
  new_result = {}
321
350
  for inst in instruments:
322
- new_result[inst] = dict(sorted(result[inst].items(), key=cmp_to_key(cmp), reverse=True))
351
+ new_result[inst] = dict(sorted(result[inst].items(), key=custom_sort_key, reverse=True))
323
352
 
324
353
  if verbose:
325
354
  logger.info('RVs available from')
arvi/timeseries.py CHANGED
@@ -765,13 +765,19 @@ class RV:
765
765
  if isinstance(files, str):
766
766
  files = [files]
767
767
 
768
- CCFs = iCCF.from_file(files)
768
+ hdu_number = kwargs.pop('hdu_number', 1)
769
+ data_index = kwargs.pop('data_index', -1)
770
+ CCFs = iCCF.from_file(files, hdu_number=hdu_number, data_index=data_index)
769
771
 
770
772
  if not isinstance(CCFs, list):
771
773
  CCFs = [CCFs]
772
774
 
773
- objects = np.unique([i.HDU[0].header['OBJECT'].replace(' ', '') for i in CCFs])
774
- if objects.size != 1:
775
+ try:
776
+ objects = [i.OBJECT for i in CCFs]
777
+ except AttributeError:
778
+ objects = np.unique([i.HDU[0].header['OBJECT'].replace(' ', '') for i in CCFs])
779
+
780
+ if len(objects) != 1:
775
781
  logger.warning(f'found {objects.size} different stars in the CCF files, '
776
782
  'choosing the first one')
777
783
  star = objects[0]
@@ -808,7 +814,7 @@ class RV:
808
814
 
809
815
  _s.mask = np.full_like(_s.time, True, dtype=bool)
810
816
 
811
- _s.drs_qc = np.array([i.HDU[0].header['HIERARCH ESO QC SCIRED CHECK'] for i in CCFs], dtype=bool)
817
+ _s.drs_qc = np.array([i.HDU[0].header['*QC SCIRED CHECK'][0] for i in CCFs], dtype=bool)
812
818
  # mask out drs_qc = False
813
819
  if not _s.drs_qc.all():
814
820
  n = (~ _s.drs_qc).sum()
@@ -859,7 +865,7 @@ class RV:
859
865
  fits_file = f'{star}_RVs.fits'
860
866
 
861
867
  local_exists = os.path.exists(local_targz_file)
862
- local_recent = os.path.getmtime(local_targz_file) > pytime() - 60*60*2
868
+ local_recent = local_exists and os.path.getmtime(local_targz_file) > pytime() - 60*60*2
863
869
 
864
870
  if os.path.exists(os.path.join(directory, fits_file)):
865
871
  logger.info(f'found file "{fits_file}" in "{directory}"')
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: arvi
3
- Version: 0.1.29
3
+ Version: 0.1.30
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -20,6 +20,7 @@ Requires-Dist: loguru
20
20
  Requires-Dist: tqdm
21
21
  Requires-Dist: pySWEETCat
22
22
  Requires-Dist: kepmodel
23
+ Dynamic: license-file
23
24
 
24
25
  <p align="center">
25
26
  <img width = "140" src="https://github.com/j-faria/arvi/blob/main/docs/logo/logo.png?raw=true"/>
@@ -58,7 +59,7 @@ s = RV('HD1234', instrument='ESPRESSO')
58
59
 
59
60
  #### Current version
60
61
 
61
- ![PyPI - Version](https://img.shields.io/pypi/v/arvi)
62
+ [![PyPI - Version](https://img.shields.io/pypi/v/arvi?color=32c854)](https://pypi.org/project/arvi/)
62
63
 
63
64
  #### Actions
64
65
 
@@ -4,7 +4,7 @@ arvi/ariadne_wrapper.py,sha256=YvilopJa9T4NwPcj3Nah_U8smSeSAU5-HYZMb_GJ-BQ,2232
4
4
  arvi/berv.py,sha256=eKnpuPC1w45UrUEyFRbs9F9j3bXz3kxYzNXbnRgvFQM,17596
5
5
  arvi/binning.py,sha256=jbemJ-bM3aqoOsqMo_OhWt_co-JAQ0nhdG_GpTsrRsw,15403
6
6
  arvi/config.py,sha256=W-v8NNhRd_PROu0wCMilXmOhYcju4xbUalugd5u7SRU,1881
7
- arvi/dace_wrapper.py,sha256=dwGj_XuN8J5An9I8ioeK7saj2TNLwwcobOu6oRo_HmM,22228
7
+ arvi/dace_wrapper.py,sha256=C2TZwskbODMVRGi-xdCW9sCDQrUx5Z2ZM7yVWkeKde4,23463
8
8
  arvi/extra_data.py,sha256=cpJGMle0ZqY_dtrmbbMQcyU48PkNjfzUgQ-qY-2XTj8,3249
9
9
  arvi/gaia_wrapper.py,sha256=2q_7bm6MGvTLlegfNUCY_EhnMKYv1CZmcbanOm_ot-k,4197
10
10
  arvi/headers.py,sha256=uvdJebw1M5YkGjE3vJJwYBOnLikib75uuZE9FXB5JJM,1673
@@ -20,7 +20,7 @@ arvi/simbad_wrapper.py,sha256=hyMnTeZ4DpnTzyEopkdUfNtJ_roSgdvYPXwYcmXVX2U,8238
20
20
  arvi/spectra.py,sha256=ebF1ocodTastLx0CyqLSpE8EZNDXBF8riyfxMr3L6H0,7491
21
21
  arvi/stats.py,sha256=ilzzGL9ew-SyVa9eEdrYCpD3DliOAwhoNUg9LIlHjzU,2583
22
22
  arvi/stellar.py,sha256=veuL_y9kJvvApU_jqYQqP3EkcRnQffTc8Us6iT5UrFI,3790
23
- arvi/timeseries.py,sha256=ZHk0SgkzlWELyklcnVi586qAGvHIH7PwTqIE-ScX6u0,87830
23
+ arvi/timeseries.py,sha256=YJ5s3TvQthIdVrZWT3S23DagM4BzT2ol5ENcnwsc_zk,88079
24
24
  arvi/translations.py,sha256=PUSrn4zvYO2MqGzUxlFGwev_tBkgJaJrIYs6NKHzbWo,951
25
25
  arvi/utils.py,sha256=LImV8iPjG8ZKjPCT9lp25_pDb-51ZZk42Hc8bzZt7M0,6568
26
26
  arvi/data/info.svg,sha256=0IMI6W-eFoTD8acnury79WJJakpBwLa4qKS4JWpsXiI,489
@@ -29,8 +29,8 @@ arvi/data/obs_affected_blue_cryostat_issues.dat,sha256=z4AK17xfz8tGTDv1FjRvQFnio
29
29
  arvi/data/extra/HD86226_PFS1.rdb,sha256=vfAozbrKHM_j8dYkCBJsuHyD01KEM1asghe2KInwVao,3475
30
30
  arvi/data/extra/HD86226_PFS2.rdb,sha256=F2P7dB6gVyzCglUjNheB0hIHVClC5RmARrGwbrY1cfo,4114
31
31
  arvi/data/extra/metadata.json,sha256=C69hIw6CohyES6BI9vDWjxwSz7N4VOYX0PCgjXtYFmU,178
32
- arvi-0.1.29.dist-info/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
33
- arvi-0.1.29.dist-info/METADATA,sha256=aRUdDo4XitNY1xqg7OpHKw1nDGT_mGIyNl4FoEJquYg,1852
34
- arvi-0.1.29.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
- arvi-0.1.29.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
36
- arvi-0.1.29.dist-info/RECORD,,
32
+ arvi-0.1.30.dist-info/licenses/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
33
+ arvi-0.1.30.dist-info/METADATA,sha256=tNPN97-xtW27OkE_vRHNtN4_VtZvJJzy2gITgy0Cupw,1921
34
+ arvi-0.1.30.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
35
+ arvi-0.1.30.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
36
+ arvi-0.1.30.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5