diff --git a/base.png b/base.png deleted file mode 100644 index b33f336f..00000000 Binary files a/base.png and /dev/null differ diff --git a/binned.png b/binned.png deleted file mode 100644 index ea274763..00000000 Binary files a/binned.png and /dev/null differ diff --git a/views/Unity/retrieveData.cs b/galaxy/views/Unity/retrieveData.cs similarity index 100% rename from views/Unity/retrieveData.cs rename to galaxy/views/Unity/retrieveData.cs diff --git a/views/Unity/tests/get.py b/galaxy/views/Unity/tests/get.py similarity index 100% rename from views/Unity/tests/get.py rename to galaxy/views/Unity/tests/get.py diff --git a/views/Unity/unity-integration.py b/galaxy/views/Unity/unity-integration.py similarity index 100% rename from views/Unity/unity-integration.py rename to galaxy/views/Unity/unity-integration.py diff --git a/views/Unity/unitySetup.sql b/galaxy/views/Unity/unitySetup.sql similarity index 100% rename from views/Unity/unitySetup.sql rename to galaxy/views/Unity/unitySetup.sql diff --git a/views/__init__.py b/galaxy/views/__init__.py similarity index 100% rename from views/__init__.py rename to galaxy/views/__init__.py diff --git a/views/lightkurve.py b/galaxy/views/lightkurve.py similarity index 100% rename from views/lightkurve.py rename to galaxy/views/lightkurve.py diff --git a/phased.png b/phased.png deleted file mode 100644 index acfe86f9..00000000 Binary files a/phased.png and /dev/null differ diff --git a/snippets/createAnomalies.py b/snippets/createAnomalies.py index 27d7e66c..85f604de 100644 --- a/snippets/createAnomalies.py +++ b/snippets/createAnomalies.py @@ -3,6 +3,7 @@ import lightkurve as lk import matplotlib.pyplot as plt from supabase import create_client, Client +import re # Import the regex library # Initialize Supabase client supabase_url = 'https://hlufptwhzkpkkjztimzo.supabase.co' @@ -16,6 +17,13 @@ def upload_to_supabase(filepath, bucket_name, folder_name, file_name): # Function to insert a new anomaly and get its ID def insert_anomaly(tic_id): + # Extract the numeric part of the TIC ID for use as the id + match = re.search(r'\d+', tic_id) + tic_id_numeric = int(match.group()) if match else None + + if tic_id_numeric is None: + raise ValueError("TIC ID must contain a numeric value to be used as the anomaly ID.") + configuration = { "mass": None, "ticId": tic_id, @@ -28,6 +36,7 @@ def insert_anomaly(tic_id): } data = { + "id": tic_id_numeric, # Use the numeric part of the TIC ID as the primary key "content": tic_id, "ticId": tic_id, "anomalytype": "planet", @@ -35,7 +44,7 @@ def insert_anomaly(tic_id): "configuration": configuration } - response = supabase.table("anomalies").insert(data).execute() + response = supabase.table("anomalies").upsert(data).execute() anomaly_id = response.data[0]['id'] return anomaly_id @@ -47,8 +56,8 @@ def generate_lightcurves(tic_id, output_dir): lc_collection = select_sector.download_all() # Plot individual light curves - lc = select_sector.download_all() fig1, ax1 = plt.subplots() + lc = select_sector.download_all() lc.plot(ax=ax1, linewidth=0, marker='.', markersize=1, color='midnightblue', alpha=0.3) fig1.savefig(os.path.join(output_dir, 'individual_light_curves.png')) plt.close(fig1) @@ -61,7 +70,7 @@ def generate_lightcurves(tic_id, output_dir): plt.close(fig2) # Bin the light curves with a larger bin time - bin_time = 1 / 24 # 1-hour binning + bin_time = 15 / 24 / 60 # 15-minute binning lc_collection_binned = lc_collection_stitched.bin(bin_time) fig3, ax3 = plt.subplots() lc_collection_binned.plot(ax=ax3, linewidth=0, marker='o', markersize=4, color='red', alpha=0.7) @@ -76,11 +85,11 @@ def generate_lightcurves(tic_id, output_dir): fig4.savefig(os.path.join(output_dir, 'stitched_and_binned_light_curves.png')) plt.close(fig4) - # Optional: Zoom in on a specific time range to highlight transits + # Zoom in on a specific time range to highlight transits fig5, ax5 = plt.subplots(figsize=(10, 5)) lc_collection_stitched.plot(ax=ax5, linewidth=0, marker='.', markersize=1, color='midnightblue', alpha=0.3, label='Unbinned') lc_collection_binned.plot(ax=ax5, linewidth=0, marker='o', markersize=4, color='red', alpha=0.7, label='Binned') - ax5.set_xlim(lc_collection_stitched.time.min().value, lc_collection_stitched.time.min().value + 10) # Example zoom range + ax5.set_xlim(lc_collection_stitched.time.min().value, lc_collection_stitched.time.min().value + 5) # Adjust zoom range here ax5.legend() fig5.savefig(os.path.join(output_dir, 'zoomed_light_curves.png')) plt.close(fig5) @@ -112,5 +121,5 @@ def main(tic_ids): print(f"Processed TIC ID {tic_id}, Anomaly ID: {anomaly_id}") if __name__ == "__main__": - tic_ids_list = ['TIC1', 'TIC2', 'TIC3'] # Replace with your actual TIC IDs - main(tic_ids_list) \ No newline at end of file + tic_ids_list = ['TIC 50365310', 'TIC 88863718'] + main(tic_ids_list) diff --git a/snippets/output/binned_light_curves.png b/snippets/output/binned_light_curves.png new file mode 100644 index 00000000..4ab55ff2 Binary files /dev/null and b/snippets/output/binned_light_curves.png differ diff --git a/snippets/output/individual_light_curves.png b/snippets/output/individual_light_curves.png new file mode 100644 index 00000000..b874bb3a Binary files /dev/null and b/snippets/output/individual_light_curves.png differ diff --git a/snippets/output/smoothed_light_curves.png b/snippets/output/smoothed_light_curves.png new file mode 100644 index 00000000..92dea27b Binary files /dev/null and b/snippets/output/smoothed_light_curves.png differ diff --git a/snippets/output/stitched_and_binned_light_curves.png b/snippets/output/stitched_and_binned_light_curves.png new file mode 100644 index 00000000..d8f7fbf3 Binary files /dev/null and b/snippets/output/stitched_and_binned_light_curves.png differ diff --git a/snippets/output/stitched_light_curves.png b/snippets/output/stitched_light_curves.png new file mode 100644 index 00000000..850bc123 Binary files /dev/null and b/snippets/output/stitched_light_curves.png differ diff --git a/snippets/output/zoomed_light_curves.png b/snippets/output/zoomed_light_curves.png new file mode 100644 index 00000000..f0395f72 Binary files /dev/null and b/snippets/output/zoomed_light_curves.png differ diff --git a/snippets/output_1/binned_light_curves.png b/snippets/output_1/binned_light_curves.png new file mode 100644 index 00000000..d06067ad Binary files /dev/null and b/snippets/output_1/binned_light_curves.png differ diff --git a/snippets/output_1/individual_light_curves.png b/snippets/output_1/individual_light_curves.png new file mode 100644 index 00000000..da767914 Binary files /dev/null and b/snippets/output_1/individual_light_curves.png differ diff --git a/snippets/output_1/smoothed_light_curves.png b/snippets/output_1/smoothed_light_curves.png new file mode 100644 index 00000000..92dea27b Binary files /dev/null and b/snippets/output_1/smoothed_light_curves.png differ diff --git a/snippets/output_1/stitched_and_binned_light_curves.png b/snippets/output_1/stitched_and_binned_light_curves.png new file mode 100644 index 00000000..e2dc9f67 Binary files /dev/null and b/snippets/output_1/stitched_and_binned_light_curves.png differ diff --git a/snippets/output_1/stitched_light_curves.png b/snippets/output_1/stitched_light_curves.png new file mode 100644 index 00000000..aef6a0f7 Binary files /dev/null and b/snippets/output_1/stitched_light_curves.png differ diff --git a/snippets/output_1/zoomed_light_curves.png b/snippets/output_1/zoomed_light_curves.png new file mode 100644 index 00000000..37b4c116 Binary files /dev/null and b/snippets/output_1/zoomed_light_curves.png differ diff --git a/snippets/zoomed_curves.py b/snippets/zoomed_curves.py index 32dad358..3d2e0fbd 100644 --- a/snippets/zoomed_curves.py +++ b/snippets/zoomed_curves.py @@ -2,7 +2,7 @@ import shutil import matplotlib.pyplot as plt import lightkurve as lk - + # Clear the output directory output_dir = 'output' if os.path.exists(output_dir): @@ -36,7 +36,7 @@ plt.close(fig2) # Bin the light curves with a larger bin time -bin_time = 1 / 24 # 1-hour binning +bin_time = 1 / 12 lc_collection_binned = lc_collection_stitched.bin(bin_time) fig3, ax3 = plt.subplots() lc_collection_binned.plot(ax=ax3, linewidth=0, marker='o', markersize=4, color='red', alpha=0.7) @@ -51,11 +51,11 @@ fig4.savefig(os.path.join(output_dir, 'stitched_and_binned_light_curves.png')) plt.close(fig4) -# Optional: Zoom in on a specific time range to highlight transits +# Zoom in on a specific time range to highlight transits fig5, ax5 = plt.subplots(figsize=(10, 5)) lc_collection_stitched.plot(ax=ax5, linewidth=0, marker='.', markersize=1, color='midnightblue', alpha=0.3, label='Unbinned') lc_collection_binned.plot(ax=ax5, linewidth=0, marker='o', markersize=4, color='red', alpha=0.7, label='Binned') -ax5.set_xlim(lc_collection_stitched.time.min().value, lc_collection_stitched.time.min().value + 10) # Example zoom range +ax5.set_xlim(lc_collection_stitched.time.min().value, lc_collection_stitched.time.min().value + 5) # Adjust zoom range here ax5.legend() fig5.savefig(os.path.join(output_dir, 'zoomed_light_curves.png')) plt.close(fig5) diff --git a/views/models.py b/views/models.py deleted file mode 100644 index cdb3cc3b..00000000 --- a/views/models.py +++ /dev/null @@ -1,10 +0,0 @@ -from . import db - -class Planet(db.Model): - id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(50)) - moons = db.Column(db.String(50)) - - def __init__(self, name, moons): - self.name = name - self.moons = moons \ No newline at end of file