Beispiel #1
0
def download_cache(all_trainingsets=False):
    """
	Download any missing data files to cache.

	This will download all axillary files used by Astropy or our code itself
	to the cache. If all the necessary files already exists, nothing will be done.
	It can be a good idea to call this function before starting the photometry
	in parallel on many machines sharing the same cache, in which case the processes
	will all attempt to download the cache files and may conflict with each other.

	Parameters:
		all_trainingsets (bool, optional):

	.. codeauthor:: Rasmus Handberg <*****@*****.**>
	"""

    logger = logging.getLogger(__name__)

    # This will download IERS data needed for astropy.Time transformations:
    # https://docs.astropy.org/en/stable/utils/iers.html
    logger.info("Downloading IERS data...")
    IERS_Auto().open()

    # Download trainingsets:
    download_tsets = trainingset_list if all_trainingsets else ['keplerq9v3']
    for tskey in download_tsets:
        logger.info("Downloading %s training set...", tskey)
        tset = get_trainingset(tskey)
        tset()

    logger.info("All cache data downloaded.")
Beispiel #2
0
def download_IERS_A(show_progress=True):
    """
    Download and cache the IERS Bulletin A table.

    If one is already cached, download a new one and overwrite the old. Store
    table in the astropy cache, and undo the monkey patching caused by earlier
    failure (if applicable).

    If one does not exist, monkey patch `~astropy.time.Time._get_delta_ut1_utc`
    so that `~astropy.time.Time` objects don't raise errors by computing UT1-UTC
    off the end of the IERS table.

    Parameters
    ----------
    show_progress : bool
        `True` shows a progress bar during the download.
    """
    # Let astropy handle all the details.
    try:
        IERS_Auto()
        # Undo monkey patch set up by exception below.
        if Time._get_delta_ut1_utc != BACKUP_Time_get_delta_ut1_utc:
            Time._get_delta_ut1_utc = BACKUP_Time_get_delta_ut1_utc
        return
    except Exception:
        warnings.warn(IERS_A_WARNING, OldEarthOrientationDataWarning)
        Time._get_delta_ut1_utc = _low_precision_utc_to_ut1
Beispiel #3
0
def download_cache():
    """
	Download any missing data files to cache.

	This will download all auxillary files used by astropy or our code itself
	to the cache. If all the nessacery files already exists, nothing will be done.
	It can be a good idea to call this function before starting the photometry
	in parallel on many machines sharing the same cache, in which case the processes
	will all attempt to download the cache files and may conflict with each other.

	.. codeauthor:: Rasmus Handberg <*****@*****.**>
	"""

    logger = logging.getLogger(__name__)

    # This will download IERS data needed for astropy.Time transformations:
    # https://docs.astropy.org/en/stable/utils/iers.html
    logger.info("Downloading IERS data...")
    IERS_Auto().open()

    # The TESS SPICE kernels should be downloaded, if they
    # are not already.
    # We also make sure to unload any loaded kernels again,
    # to ensure that this function has zero effect.
    logger.info("Downloading SPICE kernels...")
    with TESS_SPICE() as tsp:
        tsp.unload()

    logger.info("All cache data downloaded.")
Beispiel #4
0
from astropy import units as u
from astropy.utils.iers import IERS_Auto

from cats.simulator.detector import Crires
from cats.extractor.runner import CatsRunner

# TODO List:
# - automatically mask points before fitting with SME
# - if star and planet steps aren't run manually, we use the initial values
#   instead we should load the data if possible
# - Tests for all the steps
# - Refactoring of the steps, a lot of the code is strewm all over the place
# - Determine Uncertainties for each point

# Update IERS tables if necessary
IERS_Auto()

# Detector
setting = "K/2/4"
detectors = [1, 2, 3]
orders = [7, 6, 5, 4, 3, 2]
detector = Crires(setting, detectors, orders=orders)

# Linelist
linelist = join(dirname(__file__), "crires_k_2_4.lin")

# Star info
star = "HD209458"
planet = "b"

# Initialize the CATS runner