TESSify 0.1.0__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.
- TESSify/__init__.py +1 -0
- TESSify/main.py +174 -0
- tessify-0.1.0.dist-info/METADATA +155 -0
- tessify-0.1.0.dist-info/RECORD +7 -0
- tessify-0.1.0.dist-info/WHEEL +5 -0
- tessify-0.1.0.dist-info/licenses/LICENSE.txt +21 -0
- tessify-0.1.0.dist-info/top_level.txt +1 -0
TESSify/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from main import *
|
TESSify/main.py
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
from lightkurve import TessLightCurveFile, TessTargetPixelFile
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
from json import loads, dumps
|
|
4
|
+
from os import makedirs, chdir, system, getcwd
|
|
5
|
+
from gc import collect
|
|
6
|
+
from tkinter import Tk, Label
|
|
7
|
+
from PIL import Image, ImageTk
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Project():
|
|
11
|
+
def __init__(self):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
def create(self, name):
|
|
15
|
+
self.name = name
|
|
16
|
+
makedirs(name)
|
|
17
|
+
chdir(name)
|
|
18
|
+
self.cpath = getcwd()
|
|
19
|
+
self.setup()
|
|
20
|
+
|
|
21
|
+
def restore(self, name):
|
|
22
|
+
self.name = name
|
|
23
|
+
chdir(name)
|
|
24
|
+
self.cpath = getcwd()
|
|
25
|
+
self.config_file = open(r"config.json", "r")
|
|
26
|
+
self.config = loads(self.config_file.read())
|
|
27
|
+
self.config_file.close()
|
|
28
|
+
|
|
29
|
+
def setup(self):
|
|
30
|
+
makedirs(r"LightCurves")
|
|
31
|
+
makedirs(r"TargetPixels")
|
|
32
|
+
makedirs(r"Graphs")
|
|
33
|
+
self.dwprogress = {"Type":None, "Script": None, "ToDownload": None, "Downloaded": 0, "List": []}
|
|
34
|
+
self.pcprogress = {"ToProcess": None, "Processed": 0, "List": []}
|
|
35
|
+
self.fnprogress = {"ToFinalise": None, "Finalised": 0, "List": []}
|
|
36
|
+
self.config_file = open(r"config.json", "w")
|
|
37
|
+
self.config = {
|
|
38
|
+
"Name": self.name,
|
|
39
|
+
"Download_Progress": self.dwprogress,
|
|
40
|
+
"Processing_Progress": self.pcprogress,
|
|
41
|
+
"Finalising_Progress": self.fnprogress
|
|
42
|
+
}
|
|
43
|
+
self.config_file.write(dumps(self.config))
|
|
44
|
+
self.config_file.close()
|
|
45
|
+
|
|
46
|
+
def updateconfig(self):
|
|
47
|
+
chdir(self.cpath)
|
|
48
|
+
self.config_file = open("config.json", "w")
|
|
49
|
+
self.config_file.write(dumps(self.config))
|
|
50
|
+
self.config_file.close()
|
|
51
|
+
|
|
52
|
+
def download(self, type, script_path, amount):
|
|
53
|
+
self.config["Download_Progress"]["Script"] = script_path
|
|
54
|
+
self.config["Download_Progress"]["Type"] = type
|
|
55
|
+
self.config["Download_Progress"]["ToDownload"] = amount
|
|
56
|
+
self.updateconfig()
|
|
57
|
+
script = open(script_path, "r")
|
|
58
|
+
lnum = 0
|
|
59
|
+
chdir(self.cpath)
|
|
60
|
+
if type=="lc":
|
|
61
|
+
chdir(r"LightCurves")
|
|
62
|
+
elif type=="tp":
|
|
63
|
+
chdir(r"TargetPixels")
|
|
64
|
+
else:
|
|
65
|
+
raise TypeError
|
|
66
|
+
commands = []
|
|
67
|
+
for x in range(amount):
|
|
68
|
+
commands.append(script.readline().strip())
|
|
69
|
+
script.close()
|
|
70
|
+
for x in commands:
|
|
71
|
+
if lnum<self.config["Download_Progress"]["Downloaded"]:
|
|
72
|
+
continue
|
|
73
|
+
elif lnum>=self.config["Download_Progress"]["Downloaded"] and self.config["Download_Progress"]["Downloaded"]<=self.config["Download_Progress"]["ToDownload"]:
|
|
74
|
+
system(x)
|
|
75
|
+
lnum+=1
|
|
76
|
+
self.config["Download_Progress"]["Downloaded"]+=1
|
|
77
|
+
self.config["Download_Progress"]["List"].append(x.split(" ")[-2])
|
|
78
|
+
print(f"{lnum}/{amount}")
|
|
79
|
+
self.updateconfig()
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def process(self, amount):
|
|
83
|
+
self.config["Processing_Progress"]["ToProcess"] = amount
|
|
84
|
+
lnum = 0
|
|
85
|
+
self.updateconfig()
|
|
86
|
+
paths = []
|
|
87
|
+
for x in range(amount):
|
|
88
|
+
paths.append(self.config["Download_Progress"]["List"][x])
|
|
89
|
+
for x in paths:
|
|
90
|
+
if lnum<self.config["Processing_Progress"]["Processed"]:
|
|
91
|
+
continue
|
|
92
|
+
elif lnum>=self.config["Processing_Progress"]["Processed"] and self.config["Processing_Progress"]["Processed"]<=self.config["Processing_Progress"]["ToProcess"]:
|
|
93
|
+
indpath = self.indprocess(x)
|
|
94
|
+
lnum+=1
|
|
95
|
+
self.config["Processing_Progress"]["Processed"]+=1
|
|
96
|
+
self.config["Processing_Progress"]["List"].append(indpath)
|
|
97
|
+
print(f"{lnum}/{amount}")
|
|
98
|
+
self.updateconfig()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def indprocess(self, path):
|
|
102
|
+
if self.config["Download_Progress"]["Type"]=="lc":
|
|
103
|
+
lc = TessLightCurveFile(fr"LightCurves\{path}")
|
|
104
|
+
lc = lc.remove_nans().flatten()
|
|
105
|
+
lc.plot()
|
|
106
|
+
plt.savefig(getcwd()+fr"\Graphs\{path.strip('.fits')+'.jpeg'}", bbox_inches="tight")
|
|
107
|
+
plt.close()
|
|
108
|
+
del lc
|
|
109
|
+
collect()
|
|
110
|
+
return path.strip('.fits')+'.jpeg'
|
|
111
|
+
elif self.config["Download_Progress"]["Type"]=="tp":
|
|
112
|
+
tp = TessTargetPixelFile(fr"TargetPixels\{path}")
|
|
113
|
+
tp = tp.to_lightcurve(aperture_mask="all")
|
|
114
|
+
tp = tp.remove_nans().flatten()
|
|
115
|
+
tp.plot()
|
|
116
|
+
plt.savefig(getcwd()+fr"\Graphs\{path.strip('.fits')+'.jpeg'}", bbox_inches="tight")
|
|
117
|
+
plt.close()
|
|
118
|
+
del tp
|
|
119
|
+
collect()
|
|
120
|
+
return path.strip('.fits')+'.jpeg'
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def finalise(self, amount):
|
|
124
|
+
self.config["Finalising_Progress"]["ToFinalise"] = amount
|
|
125
|
+
self.updateconfig()
|
|
126
|
+
lnum = 0
|
|
127
|
+
imagelist = []
|
|
128
|
+
for x in range(amount):
|
|
129
|
+
imagelist.append(self.config["Processing_Progress"]["List"][x])
|
|
130
|
+
imagelist = imagelist[self.config["Finalising_Progress"]["Finalised"]:self.config["Finalising_Progress"]["ToFinalise"]]
|
|
131
|
+
self.indfinalise(imagelist)
|
|
132
|
+
|
|
133
|
+
def indfinalise(self, image_paths):
|
|
134
|
+
index = 0
|
|
135
|
+
root = Tk()
|
|
136
|
+
root.title("Image Viewer")
|
|
137
|
+
label = Label(root)
|
|
138
|
+
label.pack()
|
|
139
|
+
|
|
140
|
+
if not image_paths:
|
|
141
|
+
pass
|
|
142
|
+
|
|
143
|
+
def update_image():
|
|
144
|
+
nonlocal index
|
|
145
|
+
photo = ImageTk.PhotoImage(Image.open(getcwd()+fr"/Graphs/{image_paths[index]}"))
|
|
146
|
+
label.config(image=photo)
|
|
147
|
+
label.image = photo
|
|
148
|
+
|
|
149
|
+
def key_handler(event):
|
|
150
|
+
nonlocal index
|
|
151
|
+
if event.keysym == 'Right' and index!=len(image_paths)-1:
|
|
152
|
+
index = (index + 1) % len(image_paths)
|
|
153
|
+
update_image()
|
|
154
|
+
elif event.keysym == 'Left' and index!=0:
|
|
155
|
+
index = (index - 1) % len(image_paths)
|
|
156
|
+
update_image()
|
|
157
|
+
elif event.keysym == 'Down':
|
|
158
|
+
self.config["Finalising_Progress"]["List"].append(image_paths[index])
|
|
159
|
+
print(f"Appended: {image_paths[index]}")
|
|
160
|
+
self.updateconfig()
|
|
161
|
+
elif event.keysym == 'Escape':
|
|
162
|
+
self.config["Finalising_Progress"]["Finalised"]+=index+1
|
|
163
|
+
self.updateconfig()
|
|
164
|
+
root.destroy()
|
|
165
|
+
|
|
166
|
+
root.bind("<Key>", key_handler)
|
|
167
|
+
update_image()
|
|
168
|
+
root.mainloop()
|
|
169
|
+
|
|
170
|
+
def getresults(self):
|
|
171
|
+
finallist = []
|
|
172
|
+
for x in set(self.config["Finalising_Progress"]["List"]):
|
|
173
|
+
finallist.append("TIC "+x.split("-")[2].lstrip("0"))
|
|
174
|
+
return finallist
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TESSify
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python package for helping with detecting exoplanet transit dips in TESS light curves.
|
|
5
|
+
Home-page: https://github.com/arpit290/TESSify
|
|
6
|
+
Author: Arpit Bishnoi
|
|
7
|
+
Author-email: bishnoiarpit29@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.txt
|
|
14
|
+
Requires-Dist: lightkurve
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Requires-Dist: matplotlib
|
|
17
|
+
Requires-Dist: pillow
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
# TESSify
|
|
30
|
+
A Python package for helping with detecting exoplanet transit dips in TESS light curves.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## ๐ Features
|
|
35
|
+
|
|
36
|
+
- Load and clean `.fits` light curve or target pixel files
|
|
37
|
+
- Visualize light curves and transit candidates
|
|
38
|
+
- Designed for students, researchers, and citizen scientists
|
|
39
|
+
- Easily download and process raw data in bulk
|
|
40
|
+
- Easily shortlist potential exoplanet candidates
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ๐ฆ Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install TESSify
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## ๐ ๏ธ Usage
|
|
53
|
+
|
|
54
|
+
Importing TESSify
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from TESSify import Project
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Creating a Project
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
a = Project()
|
|
64
|
+
a.create("YOUR_PROJECT_NAME")
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Restoring a Project
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
a.restore("YOUR_PROJECT_NAME")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Downloading `.fits` files in bulk
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
#You can get bulk downloading scripts from the official TESS archive at `https://archive.stsci.edu/tess/bulk_downloads/bulk_downloads_ffi-tp-lc-dv.html`
|
|
77
|
+
#You can download either Target Pixel (tp) or Light Curve (lc) files. After download, copy the path of the file.
|
|
78
|
+
|
|
79
|
+
from TESSify import Project
|
|
80
|
+
|
|
81
|
+
a = Project()
|
|
82
|
+
|
|
83
|
+
a.create("Project1")
|
|
84
|
+
|
|
85
|
+
a.download("lc", r"C:\Users\Expert\Downloads\tesscurl_sector_89_lc.sh", 100)
|
|
86
|
+
#Enter "lc" for lightcurve and "tp" for targetpixel
|
|
87
|
+
#Enter the path of the script
|
|
88
|
+
#Enter the amount of files to be downloaded
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Processing the files in bulk
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
#After Downloading the files, now its time to process them
|
|
96
|
+
|
|
97
|
+
from TESSify import Project
|
|
98
|
+
|
|
99
|
+
a = Project()
|
|
100
|
+
|
|
101
|
+
a.restore("Project1")
|
|
102
|
+
|
|
103
|
+
a.process(100)
|
|
104
|
+
#Enter the amount of files to process (It cannot be greater than the ones you have downloaded)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Finalising the LightCurves and watching out for Transit Dips
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
#After you have processed the files, you can see their graphs to see if there are any dips that would indicate the esistence of an exoplanet
|
|
111
|
+
|
|
112
|
+
from TESSify import Project
|
|
113
|
+
|
|
114
|
+
a = Project()
|
|
115
|
+
|
|
116
|
+
a.restore("Project1")
|
|
117
|
+
|
|
118
|
+
a.finalise(100)
|
|
119
|
+
#Enter the amount of files to finalise (It cannot be greater than the ones you have processed)
|
|
120
|
+
#This would open a window which you can navigate by:
|
|
121
|
+
# "Right Keyboard Button" - Next Slide
|
|
122
|
+
# "Left Keyboard Button" - Previous Slide
|
|
123
|
+
# "Down Keyboard Button" - Shortlist Slide (If you see something of interest)
|
|
124
|
+
# "Escape Button" - Exit Program
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Getting the List of the Shortlisted Entities
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
#After Shortlisting several potential candidates, you might want them in a list format
|
|
131
|
+
|
|
132
|
+
from TESSify import Project
|
|
133
|
+
|
|
134
|
+
a = Project()
|
|
135
|
+
|
|
136
|
+
a.restore("Project1")
|
|
137
|
+
|
|
138
|
+
finalised_list = a.getresults()
|
|
139
|
+
# This returns a list in the TIC + ID format
|
|
140
|
+
|
|
141
|
+
print(finalised_list)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
## ๐ง Contributing
|
|
146
|
+
Contributions are welcome! Open an issue or submit a pull request at `https://github.com/arpit290/TESSify`
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
## ๐ License
|
|
150
|
+
This project is licensed under the MIT License. See `LICENSE` for details.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
## ๐ค Author
|
|
154
|
+
Arpit Bishnoi
|
|
155
|
+
`https://github.com/arpit290` ยท `bishnoiarpit29@gmail.com`
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
TESSify/__init__.py,sha256=ZqtQXRSYei5MUjZpwepQacPmmzGR1vD4An6hy9pWrzc,20
|
|
2
|
+
TESSify/main.py,sha256=AWRQk7hdzF_0osURLAn8xj7N_bKkPwqydiFn-3j0WGk,6673
|
|
3
|
+
tessify-0.1.0.dist-info/licenses/LICENSE.txt,sha256=Eyq1wNJ50hfk9B92j1Py80MlyijLx4YRgAr6UYgzRu8,1065
|
|
4
|
+
tessify-0.1.0.dist-info/METADATA,sha256=4DGR7WfMdurktM0VOiu7dcnZacgXeY67M1DDaxPgif0,3791
|
|
5
|
+
tessify-0.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
6
|
+
tessify-0.1.0.dist-info/top_level.txt,sha256=dmSNY13Nndp-rUDgidjL5XYuU5SGmKeAYcvbpDxw_Fw,8
|
|
7
|
+
tessify-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 arpit290
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TESSify
|