arvi 0.2.3__py3-none-any.whl → 0.2.4__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/config.py CHANGED
@@ -8,6 +8,7 @@ def get_config_path():
8
8
 
9
9
  def get_config():
10
10
  config = configparser.ConfigParser()
11
+ config.add_section('config')
11
12
  if (path := get_config_path()).exists():
12
13
  config.read(path)
13
14
  return config
@@ -33,6 +34,8 @@ class config:
33
34
  'request_as_public': False,
34
35
  # enable from arvi import star_name
35
36
  'fancy_import': True,
37
+ # use the 'dark_background' matplotlib theme
38
+ 'dark_plots': False,
36
39
  # debug
37
40
  'debug': False,
38
41
  }
arvi/dace_wrapper.py CHANGED
@@ -47,8 +47,9 @@ def load_spectroscopy(user=None):
47
47
  logger.warning('requesting DACE data as public (no .dacerc file found)')
48
48
  return default_Spectroscopy
49
49
 
50
- @lru_cache()
51
- def get_dace_id(star, verbose=True):
50
+
51
+ @lru_cache(maxsize=1024)
52
+ def get_dace_id(star, verbose=True, raise_error=False):
52
53
  logger = setup_logger()
53
54
  filters = {"obj_id_catname": {"equal": [star]}}
54
55
  try:
@@ -58,8 +59,11 @@ def get_dace_id(star, verbose=True):
58
59
  except KeyError:
59
60
  if verbose:
60
61
  logger.error(f"Could not find DACE ID for {star}")
62
+ if not raise_error:
63
+ return None
61
64
  raise ValueError from None
62
65
 
66
+
63
67
  def get_arrays(result, latest_pipeline=True, ESPRESSO_mode='HR11', NIRPS_mode='HE', verbose=True):
64
68
  logger = setup_logger()
65
69
  arrays = []
@@ -70,7 +74,6 @@ def get_arrays(result, latest_pipeline=True, ESPRESSO_mode='HR11', NIRPS_mode='H
70
74
 
71
75
  # select ESPRESSO mode, which is defined at the level of the pipeline
72
76
  if 'ESPRESSO' in inst:
73
-
74
77
  find_mode = [ESPRESSO_mode in pipe for pipe in pipelines]
75
78
  # the mode was not found
76
79
  if not any(find_mode):
@@ -164,12 +167,12 @@ def get_observations_from_instrument(star, instrument, user=None, main_id=None,
164
167
 
165
168
  found_dace_id = False
166
169
  try:
167
- dace_id = get_dace_id(star, verbose=verbose)
170
+ dace_id = get_dace_id(star, verbose=verbose, raise_error=True)
168
171
  found_dace_id = True
169
172
  except ValueError as e:
170
173
  if main_id is not None:
171
174
  try:
172
- dace_id = get_dace_id(main_id, verbose=verbose)
175
+ dace_id = get_dace_id(main_id, verbose=verbose, raise_error=True)
173
176
  found_dace_id = True
174
177
  except ValueError:
175
178
  pass
arvi/plots.py CHANGED
@@ -13,10 +13,12 @@ from .utils import lazy_import
13
13
  plt = lazy_import('matplotlib.pyplot')
14
14
 
15
15
 
16
- def plot_fast(func):
16
+ def plot_settings(func):
17
17
  @wraps(func)
18
18
  def wrapper(*args, **kwargs):
19
- with plt.style.context('fast'):
19
+ # with plt.style.context('fast'):
20
+ theme = 'dark_background' if config.dark_plots else 'fast'
21
+ with plt.style.context(theme):
20
22
  return func(*args, **kwargs)
21
23
  return wrapper
22
24
 
@@ -135,7 +137,7 @@ def clickable_legend(fig, ax, leg):
135
137
  pass
136
138
  return on_pick_legend
137
139
 
138
- # @plot_fast
140
+ @plot_settings
139
141
  def plot(self, ax=None, show_masked=False, instrument=None, time_offset=0,
140
142
  remove_50000=False, tooltips=True, show_title=False, show_legend=True, label=None,
141
143
  jitter=None, N_in_label=False, versus_n=False, show_histogram=False, bw=False, **kwargs):
@@ -403,7 +405,7 @@ def plot(self, ax=None, show_masked=False, instrument=None, time_offset=0,
403
405
  return fig, ax
404
406
 
405
407
 
406
- @plot_fast
408
+ # @plot_fast
407
409
  def plot_quantity(self, quantity, ax=None, show_masked=False, instrument=None,
408
410
  time_offset=0, remove_50000=False, tooltips=False, show_legend=True,
409
411
  N_in_label=False, **kwargs):
@@ -506,7 +508,88 @@ plot_rhk = partialmethod(plot_quantity, quantity='rhk')
506
508
  plot_berv = partialmethod(plot_quantity, quantity='berv')
507
509
 
508
510
 
509
- @plot_fast
511
+ def plot_xy(self, x, y, ax=None, instrument=None, show_legend=True, **kwargs):
512
+ logger = setup_logger()
513
+ if self.N == 0:
514
+ if self.verbose:
515
+ logger.error('no data to plot')
516
+ return
517
+
518
+ if ax is None:
519
+ fig, ax = plt.subplots(1, 1, constrained_layout=True)
520
+ else:
521
+ fig = ax.figure
522
+
523
+ kwargs.setdefault('marker', 'o')
524
+ kwargs.setdefault('ls', '')
525
+ kwargs.setdefault('capsize', 0)
526
+ kwargs.setdefault('ms', 4)
527
+
528
+ instruments = self._check_instrument(instrument)
529
+
530
+ for inst in instruments:
531
+ s = self if self._child else getattr(self, inst)
532
+ label = inst
533
+
534
+ missing = False
535
+ try:
536
+ xdata = getattr(s, x).copy()
537
+ except AttributeError:
538
+ missing = True
539
+ try:
540
+ e_xdata = getattr(s, x + '_err').copy()
541
+ except AttributeError:
542
+ e_xdata = np.zeros_like(xdata)
543
+
544
+ try:
545
+ ydata = getattr(s, y).copy()
546
+ except AttributeError:
547
+ missing = True
548
+ try:
549
+ e_ydata = getattr(s, y + '_err').copy()
550
+ except AttributeError:
551
+ e_ydata = np.zeros_like(ydata)
552
+
553
+ if missing:
554
+ lines, *_ = ax.errorbar([], [], [],
555
+ label=label, picker=True, **kwargs)
556
+ continue
557
+
558
+ ax.errorbar(xdata[s.mask], ydata[s.mask], e_xdata[s.mask], e_ydata[s.mask],
559
+ label=label, **kwargs)
560
+
561
+ # if show_masked:
562
+ # ax.errorbar(self.time[~self.mask] - time_offset,
563
+ # getattr(self, quantity)[~self.mask],
564
+ # getattr(self, quantity + '_err')[~self.mask],
565
+ # label='masked', fmt='x', ms=10, color='k', zorder=-2)
566
+
567
+ if show_legend:
568
+ leg = ax.legend()
569
+ on_pick_legend = clickable_legend(fig, ax, leg)
570
+ plt.connect('pick_event', on_pick_legend)
571
+
572
+ ax.minorticks_on()
573
+
574
+ delta = 'Δ' if self._did_adjust_means else ''
575
+
576
+ # ylabel = {
577
+ # quantity.lower(): quantity,
578
+ # 'fwhm': f'{delta}FWHM [{self.units}]',
579
+ # 'bispan': f'{delta}BIS [{self.units}]',
580
+ # 'rhk': r"$\log$ R'$_{HK}$",
581
+ # 'berv': 'BERV [km/s]',
582
+ # }
583
+
584
+ # ax.set_ylabel(ylabel[quantity.lower()])
585
+
586
+ if config.return_self:
587
+ return self
588
+ else:
589
+ return fig, ax
590
+
591
+
592
+ # @plot_fast
510
593
  def gls(self, ax=None, label=None, instrument=None,
511
594
  fap=True, fap_method='baluev', adjust_means=config.adjust_means_gls,
512
595
  picker=True, **kwargs):
arvi/setup_logger.py CHANGED
@@ -6,7 +6,7 @@ def setup_logger():
6
6
  import marimo as mo
7
7
  if mo.running_in_notebook():
8
8
  raise NotImplementedError
9
- except NotImplementedError:
9
+ except (NotImplementedError, AttributeError):
10
10
  pass
11
11
  except (ImportError, ModuleNotFoundError):
12
12
  logger.remove()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arvi
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: The Automated RV Inspector
5
5
  Author-email: João Faria <joao.faria@unige.ch>
6
6
  License: MIT
@@ -23,7 +23,7 @@ Requires-Dist: kepmodel
23
23
  Dynamic: license-file
24
24
 
25
25
  <p align="center">
26
- <img width = "140" src="https://github.com/j-faria/arvi/blob/main/docs/logo/logo.png?raw=true"/>
26
+ <img width = "140" src="https://raw.githubusercontent.com/j-faria/arvi/refs/heads/main/docs/logo/logo.png"/>
27
27
  </p>
28
28
 
29
29
  This package sits alongside [DACE](https://dace.unige.ch/) to help with the
@@ -3,8 +3,8 @@ arvi/__init__.py,sha256=8IeHbu8LR1H3MxVi9aJHNpBU6SDbmzj9FZGKsiF0AKE,740
3
3
  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=NK9y9bUrdyWCbh79LkcRABHG-n5MtlETMHMvLj1z-OM,15437
6
- arvi/config.py,sha256=mqDYcxd8RLQz2L8x4GM6jGX8uG7FRFfz-yHGDmB08I8,2222
7
- arvi/dace_wrapper.py,sha256=TxHEtAKLhlrtQyEpZuDqa-CCT0Vz8UisvF1BTpHrnpw,23516
6
+ arvi/config.py,sha256=JkHSwF-EEqwwbcc8thGgbFc9udDZPjQH-9XFjqDepBY,2337
7
+ arvi/dace_wrapper.py,sha256=uUiHHqyU8T74cmgGtVVoJKbVnTGLjNYYIUkR2BeAtvk,23636
8
8
  arvi/exofop_wrapper.py,sha256=8S7UEcrBAgANIweMV0-CvaWaVTPgGVo8vQQk_KRa0nU,2414
9
9
  arvi/extra_data.py,sha256=Xi65pI5kkzqlMmHGl9xFoumtH699611pJJ5PV-a_IfU,3397
10
10
  arvi/gaia_wrapper.py,sha256=jfBdK9N9ZOqHIzE5MRFmXNyN3PAOT_uzXM23MIy0POY,4371
@@ -13,10 +13,10 @@ arvi/instrument_specific.py,sha256=StRcHVDszm2a4yMWkO1pYYCsEWvXsS2ZtYTrSGD9JHM,1
13
13
  arvi/kima_wrapper.py,sha256=BvNTVqzM4lMNhLCyBFVh3T84hHfGKAFpgiYiOi4lh0g,2731
14
14
  arvi/lbl_wrapper.py,sha256=_ViGVkpakvuBR_xhu9XJRV5EKHpj5Go6jBZGJZMIS2Y,11850
15
15
  arvi/nasaexo_wrapper.py,sha256=mWt7eHgSZe4MBKCmUvMPTyUPGuiwGTqKugNBvmjOg9s,7306
16
- arvi/plots.py,sha256=4_xTrUFlR_6YyyVGlouoO1k9kndPa0s45mXGlXHjIF0,32839
16
+ arvi/plots.py,sha256=fHc6ScATCzvM4KQ77TYfHYmY6HSZ4N4oMYsLEUvxJpU,35279
17
17
  arvi/programs.py,sha256=BW7xBNKLei7NVLLW3_lsVskwzkaIoNRiHK2jn9Tn2ZM,8879
18
18
  arvi/reports.py,sha256=CKmtg5rewMyT26gbWeoZDYrL0z5Sbb6cTJry0HWk_rs,7445
19
- arvi/setup_logger.py,sha256=cdy2nG33TgcD-aRrDN8rbe0b3Kk-vwXhIe4hqQ-21fo,597
19
+ arvi/setup_logger.py,sha256=dHzO2gPjw6CaKWpYZd2f83z09tmxgi--qpp7k1jROjI,615
20
20
  arvi/simbad_wrapper.py,sha256=U1XmOR7bg_mq4KSutTgEsusjBph8BfEqHh-8YuHNMog,8629
21
21
  arvi/spectra.py,sha256=ebF1ocodTastLx0CyqLSpE8EZNDXBF8riyfxMr3L6H0,7491
22
22
  arvi/stats.py,sha256=ilzzGL9ew-SyVa9eEdrYCpD3DliOAwhoNUg9LIlHjzU,2583
@@ -30,8 +30,8 @@ arvi/data/obs_affected_blue_cryostat_issues.dat,sha256=z4AK17xfz8tGTDv1FjRvQFnio
30
30
  arvi/data/extra/HD86226_PFS1.rdb,sha256=vfAozbrKHM_j8dYkCBJsuHyD01KEM1asghe2KInwVao,3475
31
31
  arvi/data/extra/HD86226_PFS2.rdb,sha256=F2P7dB6gVyzCglUjNheB0hIHVClC5RmARrGwbrY1cfo,4114
32
32
  arvi/data/extra/metadata.json,sha256=C69hIw6CohyES6BI9vDWjxwSz7N4VOYX0PCgjXtYFmU,178
33
- arvi-0.2.3.dist-info/licenses/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
34
- arvi-0.2.3.dist-info/METADATA,sha256=vG_p_Iz1b4javtEhxs16KG-osWfRH6T2VjI0Q4dE6MI,1920
35
- arvi-0.2.3.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
36
- arvi-0.2.3.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
37
- arvi-0.2.3.dist-info/RECORD,,
33
+ arvi-0.2.4.dist-info/licenses/LICENSE,sha256=6JfQgl7SpM55t0EHMFNMnNh-AdkpGW25MwMiTnhdWQg,1068
34
+ arvi-0.2.4.dist-info/METADATA,sha256=LCnkFQigSAvVBAB-5yy53uPgFSw13sdbGYX_qreIf9s,1932
35
+ arvi-0.2.4.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
36
+ arvi-0.2.4.dist-info/top_level.txt,sha256=4EeiKDVLD45ztuflTGfQ3TU8GVjJg5Y95xS5XjI-utU,5
37
+ arvi-0.2.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5