potpyri.scripts.archives.download_gemini_data

Functions

add_options([parser, usage])

download_data(progid, date, cookie_file, ...)

Downloads the observational data from the Gemini server

download_file(fileobj, outfilename[, ...])

Download files if they do not exist already

get_associated_cals(fileobj[, archive_url, ...])

look for calibration files and save them if they dont exist already

get_full_outname(fileobj[, makedirs, ...])

Create the path to where store a file given the output directory and file name

get_observation_data(progid[, archive_url, ...])

Connect to the Gemini server given a program ID and local path to the cookie

load_cookie(cfile)

read an upload the cookie to the server

main()

mask_object_spectral_observation(data[, date])

Mask the json filelist to only spectral/science/OBJECT observations

unpack_tarfile(outtarname)

unpack downloaded tar file and remove the tar file after.

potpyri.scripts.archives.download_gemini_data.add_options(parser=None, usage=None)[source]
potpyri.scripts.archives.download_gemini_data.download_data(progid, date, cookie_file, directory)[source]

Downloads the observational data from the Gemini server

Inputs

progid : program ID date : date of observations cookie_file : path to the cookie file directory : path to the directory to store the data

potpyri.scripts.archives.download_gemini_data.download_file(fileobj, outfilename, archive_url='https://archive.gemini.edu/', cookie=None, symlink='')[source]

Download files if they do not exist already

Inputs

fileobj : file to be dowloaded outfilename : full path name for the file to be downloaded archive_url : path to the sever cookie : path to the localy-saved cookie symlink : path where to duplicate the file (science / cals folders in addition to outfilename)

Outputs

Bool : success or not for the download of each file

potpyri.scripts.archives.download_gemini_data.get_associated_cals(fileobj, archive_url='https://archive.gemini.edu/', cookie=None, delta_days=[0.0, 0.0], cal_types=['BIAS', 'FLAT'], caljson={})[source]

look for calibration files and save them if they dont exist already

Inputs

fileobj : data file that was downloaded archive_url : gemini server cookie : path to local cookie delta_days : how far away from the obseravtion date to search calibrations for cal_types : types of calibration files to look for caljson : dict of calibration files already existing

Outputs

cals : list of calibration files caljson : updated dict of saved calibration files

potpyri.scripts.archives.download_gemini_data.get_full_outname(fileobj, makedirs=True, forcedir='', outdir='')[source]

Create the path to where store a file given the output directory and file name

Inputs

fileobj : data file name makedirs : (bool) whether or not to create a folder if it does not exist (default = True) forcedir : forced path for the ouput directory. Default = ‘’ outdir : path to the output directory. Default = ‘’

Outputs

fullfilename : path to the output location and file name

potpyri.scripts.archives.download_gemini_data.get_observation_data(progid, archive_url='https://archive.gemini.edu/', feature='jsonsummary', cookie=None)[source]

Connect to the Gemini server given a program ID and local path to the cookie

Inputs

progid : program ID archive_url : path to gemini server feature : format of the data cookie : path to the cookie stored locally

Outputs

observational data

read an upload the cookie to the server

Inputs

cfile : path to cookie

Outputs

dict with the cookie path

potpyri.scripts.archives.download_gemini_data.main()[source]
potpyri.scripts.archives.download_gemini_data.mask_object_spectral_observation(data, date=[])[source]

Mask the json filelist to only spectral/science/OBJECT observations

Inputs

data : downloaded data date : observation date

Outputs

newlist : list of only spectral science files

potpyri.scripts.archives.download_gemini_data.unpack_tarfile(outtarname)[source]

unpack downloaded tar file and remove the tar file after.

Inputs

outtarname : the tar file