<jupyter_start><jupyter_text>Using TESSreduce + lightkurve to analyse variable starsTESS offers the exciting possibility of high cadence photometry for variable stars across the sky, but the bright complex background can present challenges. With TESSreduce, we can subtract the TESS background accounting for both the smooth background and the discrete background caused by detector straps from any Target Pixel File extracted from the Full Frame Images. In this notebook we show a quick tutorial on how to use **TESSreduce** to reduce a TESS light curve of a variable star  2MASS J16391840+6613293 and then use **lightkurve** to analyse it.This package is based on the Lightkurve package and operates on the TESStargetpixelfile class.<jupyter_code>import tessreduce as tr
import matplotlib.pyplot as plt
%matplotlib notebook
import numpy as np<jupyter_output><empty_output><jupyter_text>If you know the coordinates, but are not sure what sector is covered, you can use the **spacetime_lookup** function to find all relevant sectors. If you have a specific time of interest you can put that in a time as MJD, in this case time doesn't matter, so we just enter 0. The output of this function can then be given to tessreduce.<jupyter_code>ra = 249.82602 
dec = 66.22553
obs = tr.spacetime_lookup(ra=ra,dec=dec)<jupyter_output>!!! WARNING no MJD time specified, using default of 59000
|   Sector | Covers   |   Time difference  |
|          |          |             (days) |
|----------+----------+--------------------|
|       14 | False    |               -290 |
|       15 | False    |               -263 |
|       16 | False    |               -237 |
|       17 | False    |               -211 |
|       18 | False    |               -186 |
|       19 | False    |               -159 |
|       20 | False    |               -131 |
|       21 | False    |               -103 |
|       22 | False    |                -74 |
|       23 | False    |                -45 |
|       24 | False    |                -18 |
|       25 | True     |                  0 |
|       26 | False    |                  8 |
|       40 | False    |                389 |
|       41 | False    |                418 |
|       47 | False    |                578 |
|       48 | False    |                607 |
|       50 | False    |                664[...]<jupyter_text>Since we don't have any sectors that overlap with the given time, we need to specify which entry to use. In this case we'll take the first element of **obs** which corresponds to sector 14. If there is a sector that overlaps with the given time, you do not need to specify which entry to use, as the overlapping one will be automatically selected<jupyter_code>tess = tr.tessreduce(obs_list=obs[0],reduce=True)<jupyter_output>getting TPF from TESScut
made reference
made source mask
calculating background
background subtracted
calculating centroids
!!Re-running for difference image!!
shifting images
remade mask
background
Field calibration
Target is above -30 dec, calibrating to PS1 photometry.<jupyter_text>With the data reduced, we can export it as a **lightkurve.lightcurve** type object with the next line.<jupyter_code>lc = tess.to_lightkurve()<jupyter_output><empty_output><jupyter_text>Now we have access to all of the handy lightkurve functions, light **to_periodogram**!<jupyter_code>lc.to_periodogram().plot();<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0812720848056537, 'fraction_numerical': 0.037102473498233215, 'mean_word_length': 2.3567193675889326, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '141589', 'license': 'MIT', 'n_tokens_mistral': 1015, 'n_tokens_neox': 907, 'n_words': 382, 'path': 'Var_example.ipynb', 'repo_name': 'CheerfulUser/TESSreduce', 'size': '3396'}