{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "08f288ad-1317-46f4-899f-85123983430f", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-07-24 13:04:43.618628: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.\n", "2024-07-24 13:04:44.706610: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.\n", "2024-07-24 13:04:47.150987: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", "To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", "2024-07-24 13:04:49.884776: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n" ] } ], "source": [ "import eleanor" ] }, { "cell_type": "code", "execution_count": 2, "id": "31d6faec-c4de-42e1-8767-04780cae0969", "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": 3, "id": "19ead512-5776-4884-8fd2-77996fce7d63", "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 4, "id": "d679b078-f202-4fd5-9b21-86d5d93b63f1", "metadata": {}, "outputs": [ { "ename": "SearchError", "evalue": "Tess has not (yet) observed your target.", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mSearchError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/tmp/ipykernel_4070233/1832144587.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mstar\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0meleanor\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSource\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'FI Del'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m~/.local/lib/python3.9/site-packages/eleanor/source.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, tic, gaia, coords, name, fn, sector, fn_dir, tc, local, post_dir, pm_dir, metadata_path, tesscut_size, tm)\u001b[0m\n\u001b[1;32m 260\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtess_mag\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtess_mag\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 261\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 262\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlocate_on_tess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 263\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtesscut_size\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtesscut_size\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 264\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/.local/lib/python3.9/site-packages/eleanor/source.py\u001b[0m in \u001b[0;36mlocate_on_tess\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 297\u001b[0m \u001b[0;31m# tess_stars2px returns array [-1] when star not observed yet\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 298\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msectors\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m1\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0msectors\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 299\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mSearchError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Tess has not (yet) observed your target.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 300\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 301\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mSearchError\u001b[0m: Tess has not (yet) observed your target." ] } ], "source": [ "star = eleanor.Source(name='FI Del')" ] }, { "cell_type": "code", "execution_count": 5, "id": "af80e05c-d256-47f1-a0a2-707bc2bcf837", "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'star' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/tmp/ipykernel_4070233/2450107750.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0meleanor\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTargetData\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstar\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheight\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m15\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mwidth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m15\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbkg_size\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m31\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdo_psf\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdo_pca\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mNameError\u001b[0m: name 'star' is not defined" ] } ], "source": [ "data = eleanor.TargetData(star, height=15, width=15, bkg_size=31, do_psf=False, do_pca=True)" ] }, { "cell_type": "code", "execution_count": null, "id": "8b376cee-db49-4960-bd9b-73367696a04e", "metadata": {}, "outputs": [], "source": [ "q = data.quality == 0" ] }, { "cell_type": "code", "execution_count": null, "id": "9dddb6ba-e78b-40b4-a1db-4c9f8ede0613", "metadata": {}, "outputs": [], "source": [ "fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(15,4), gridspec_kw={'width_ratios':[1,3]})\n", "ax1.imshow(data.tpf[0])\n", "ax1.imshow(data.all_apertures[0], cmap='Greys', alpha=0.7)\n", "ax1.set_title('Aperture over TPF')\n", "\n", "ax2.plot(data.time[q], data.all_raw_flux[0][q]/np.nanmedian(data.all_raw_flux[0][q]), 'k', label='Raw')\n", "ax2.plot(data.time[q], data.all_corr_flux[0][q]/np.nanmedian(data.all_corr_flux[0][q]) - 0.015, 'r', label='Corrected')\n", "ax2.set_xlabel('Time [BJD - 2457000]')\n", "ax2.set_ylabel('Normalized Flux')\n", "ax2.legend();\n" ] }, { "cell_type": "code", "execution_count": null, "id": "1c06670d-9b84-4815-be24-da002232b6ce", "metadata": {}, "outputs": [], "source": [ "data.time[q]" ] }, { "cell_type": "code", "execution_count": null, "id": "f79328b6-338f-4f61-a5b4-43edd59d71cb", "metadata": {}, "outputs": [], "source": [ "data.all_corr_flux[0][q]" ] }, { "cell_type": "code", "execution_count": null, "id": "01d6671f-4a85-424e-aa12-e6e132bde3db", "metadata": {}, "outputs": [], "source": [ "data.time[q].tofile('/home/pribulla/Downloads/time.csv',sep=',',format='%12.5f')" ] }, { "cell_type": "code", "execution_count": null, "id": "503d4a63-0d7a-4c32-b1d1-3bb8db479996", "metadata": {}, "outputs": [], "source": [ "np.savetxt('/home/pribulla/Downloads/time.csv', np.transpose([data.time[q], data.all_corr_flux[0][q]]), fmt='%12.5f', delimiter=\" \")" ] }, { "cell_type": "code", "execution_count": null, "id": "b3af10c2-3212-42de-9408-a858a8b68102", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.19" } }, "nbformat": 4, "nbformat_minor": 5 }