tessapps 0.3.2__tar.gz → 0.3.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tessapps
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: TESS Aperture Photometry Pollution eStimator
5
5
  Author: Leonidas Liponis
6
6
  Requires-Python: >=3.10
@@ -39,7 +39,7 @@ Full documentation is available [here](https://codeberg.org/leolip128/tessapps/s
39
39
  - ```scipy``` (>=1.7.2): to integrate the gaussian function
40
40
  - ```astropy``` (>=5.0): to build data used in this module
41
41
  - ```astroquery``` (>=0.4.6): to find stars in the target's region
42
- - ```matplotlib``` (>=3.5): to plot the result (shows aperture mask with a caption at the bottom)
42
+ - ```matplotlib``` (>=3.5): to plot the result (image above)
43
43
  - ```lightkurve``` (>=2.0): to fetch and load tpf files
44
44
 
45
45
  Python >=3.10 is required. More information about dependencies can be found [here](https://codeberg.org/leolip128/tessapps/src/branch/main/documentation/installation/README.md).
@@ -20,7 +20,7 @@ Full documentation is available [here](https://codeberg.org/leolip128/tessapps/s
20
20
  - ```scipy``` (>=1.7.2): to integrate the gaussian function
21
21
  - ```astropy``` (>=5.0): to build data used in this module
22
22
  - ```astroquery``` (>=0.4.6): to find stars in the target's region
23
- - ```matplotlib``` (>=3.5): to plot the result (shows aperture mask with a caption at the bottom)
23
+ - ```matplotlib``` (>=3.5): to plot the result (image above)
24
24
  - ```lightkurve``` (>=2.0): to fetch and load tpf files
25
25
 
26
26
  Python >=3.10 is required. More information about dependencies can be found [here](https://codeberg.org/leolip128/tessapps/src/branch/main/documentation/installation/README.md).
@@ -13,7 +13,7 @@ requires-python = ">=3.10"
13
13
  dependencies = ["numpy>=1.21.2", "scipy>=1.7.2", "astropy>=5.0", "astroquery>=0.4.6", "matplotlib>=3.5", "lightkurve>=2.0"]
14
14
 
15
15
  [tool.bumpversion]
16
- current_version = "0.3.2"
16
+ current_version = "0.3.4"
17
17
  commit = false
18
18
  tag = false
19
19
  allow_dirty = true
@@ -2,5 +2,5 @@
2
2
 
3
3
  from tessapps.main import run
4
4
 
5
- __version__ = "0.3.2"
5
+ __version__ = "0.3.4"
6
6
  __all__ = ["run"]
@@ -7,7 +7,7 @@ warnings.filterwarnings("ignore", message=".*Cannot download from an empty searc
7
7
  import lightkurve as lk
8
8
  import numpy as np
9
9
  from scipy import integrate
10
- import matplotlib as plt
10
+ import matplotlib.pyplot as plt
11
11
  import astropy.units as u
12
12
  from astropy.table import Table
13
13
  from astropy.time import Time
@@ -22,14 +22,14 @@ from argparse import ArgumentParser
22
22
  import tessapps.tpf_to_nearby_stars as ttns # ttns -> Tessapps Tpf to Nearby Stars
23
23
  import tessapps.nearby_stars_to_data as tnsd # tnsd -> Tessapps Nearby Stars to Data
24
24
  import tessapps.data_to_contamination as tdc # tdc -> Tessapps Data to Contamination
25
- import tessapps.search_parameters_to_tpf as tspt # tspt -> Tessapps Search Parameters to Tpf
25
+ import tessapps.search_parameters_to_tpf as tspt # tspt -> Tessapps Search Parameters to TPF
26
26
 
27
27
  def run(tpf=None, pixel_overshoot=1, sigma=1, digits=3, search_info=False, result=False, plot=False, save=False, output_directory="tessapps-results"):
28
28
  if tpf is None: tpf = tspt.find_tpf(346338552, "TESS", 84, 120)
29
29
  stars = ttns.tpf_to_nearby_stars(tpf, pixel_overshoot, search_info)
30
30
  data = tnsd.data_builder(tpf, stars)
31
31
  contamination_factor, contamination_error = tdc.contribution_calculator(tpf, data, sigma, digits, result)
32
-
32
+ contamination_factor, contamination_error = np.round(contamination_factor, digits), np.round(contamination_error, digits)
33
33
  # print(data[:6])
34
34
 
35
35
  if plot:
@@ -42,7 +42,7 @@ def run(tpf=None, pixel_overshoot=1, sigma=1, digits=3, search_info=False, resul
42
42
  out_path.parent.mkdir(parents=True, exist_ok=True)
43
43
  fig.savefig(out_path, dpi=200, bbox_inches="tight")
44
44
  plt.show
45
- return [float(contamination_factor), float(contamination_error)]
45
+ return [np.round(contamination_factor, digits), np.round(contamination_error, digits)]
46
46
 
47
47
  def main(argv=None):
48
48
  parser = ArgumentParser() # prog="tapps" could be set for logs (consistency)
@@ -47,4 +47,4 @@ def data_builder(tpf, stars): # this function
47
47
  is_target = np.asarray(data["TIC"]) == int(tpf.targetid) # get the target star's position in the list
48
48
  data = data[np.lexsort((data["Tmag"], ~is_target))] # sort by ascending magnitude (bright to faint), with the target star always first
49
49
  assert data[0]["TIC"] == int(tpf.targetid), "Error: Target star missing from data" # hasn't happened yet
50
- return data
50
+ return data
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import numpy as np
2
3
  import astropy.units as u
3
4
  from astropy.wcs.utils import proj_plane_pixel_scales
@@ -35,4 +36,9 @@ def tpf_to_nearby_stars(tpf, pixel_overshoot, search_info): # this function take
35
36
  Pixel scale is {pixel_scale:.3f} deg/pixel with {scale_difference * 100:.2f}% scale difference
36
37
  The error is due to differences in horizontal ({pixel_scale_x:.5f}) and vertical ({pixel_scale_y:.5f}) pixel scales
37
38
  If the error is more than 5%, then increase 'pixel_overshoot' to make sure the search finds enough stars""")
38
- return Catalogs.query_region(center, radius=safe_radius_d, catalog="TIC")
39
+
40
+ filename = f"TIC-{tpf.targetid}_sector-{tpf.sector:04d}_exptime-{int(tpf.hdu[1].header["TIMEDEL"] * 24 * 60 * 60)}.ecsv"
41
+ if filename in os.listdir(".tessapps/"): return Table.read(f"{filename}", format="ascii.ecsv")
42
+ catalog = Catalogs.query_region(center, radius=safe_radius_d, catalog="TIC")
43
+ catalog.write(f"{filename}", format="ascii.ecsv", overwrite=True)
44
+ return catalog
File without changes