From 3f9b0c0426804b387b5acb2155e9724083edf67b Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Tue, 2 Jan 2024 16:44:18 -0800 Subject: [PATCH 1/9] remove unused files --- light_curves/code_src/mast_functions.py | 54 ------------------------- light_curves/code_src/tde_functions.py | 27 ------------- 2 files changed, 81 deletions(-) delete mode 100644 light_curves/code_src/mast_functions.py delete mode 100644 light_curves/code_src/tde_functions.py diff --git a/light_curves/code_src/mast_functions.py b/light_curves/code_src/mast_functions.py deleted file mode 100644 index 98d59f99..00000000 --- a/light_curves/code_src/mast_functions.py +++ /dev/null @@ -1,54 +0,0 @@ -## Functions related to MAST queries. -import json -import requests - -def resolve(name): - """Get the RA and Dec for an object using the MAST name resolver - - Parameters - ---------- - name: string - Name of object - - Returns - ------- - RA, Dec: tuple with position - """ - - resolverRequest = {'service':'Mast.Name.Lookup', - 'params':{'input':name, - 'format':'json' - }, - } - resolvedObjectString = mastQuery(resolverRequest) - resolvedObject = json.loads(resolvedObjectString) - # The resolver returns a variety of information about the resolved object, - # however for our purposes all we need are the RA and Dec - try: - objRa = resolvedObject['resolvedCoordinate'][0]['ra'] - objDec = resolvedObject['resolvedCoordinate'][0]['decl'] - except IndexError as e: - raise ValueError("Unknown object '{}'".format(name)) - return (objRa, objDec) - - -def mastQuery(request, url='https://mast.stsci.edu/api/v0/invoke'): - """Perform a MAST query. - - Parameters - ---------- - request: dictionary - The MAST request json object - url: string - The service URL - - Returns - ------- - the returned data content text - """ - - # Encoding the request as a json string - requestString = json.dumps(request) - r = requests.post(url, data={'request': requestString}) - r.raise_for_status() - return r.text diff --git a/light_curves/code_src/tde_functions.py b/light_curves/code_src/tde_functions.py deleted file mode 100644 index 3831111e..00000000 --- a/light_curves/code_src/tde_functions.py +++ /dev/null @@ -1,27 +0,0 @@ -from alerce.core import Alerce -from astropy.coordinates import SkyCoord - - -def TDE_id2coord(object_ids, coords, labels, verbose=1): - """ To find and append coordinates of objects with only ZTF obj name - - Parameters - ---------- - object_ids: list of strings - eg., [ "ZTF18accqogs", "ZTF19aakyhxi", "ZTF19abyylzv", "ZTF19acyfpno"] - coords : list of astropy skycoords - the coordinates of the targets for which a user wants light curves - labels: list of strings - journal articles associated with the target coordinates - verbose: int - print out debugging info (1) or not(0) - """ - - alerce = Alerce() - objects = alerce.query_objects(oid=object_ids, format="pandas") - tde_coords = [SkyCoord(ra, dec, frame='icrs', unit='deg') for ra, dec in zip(objects['meanra'], objects['meandec'])] - tde_labels = ['ZTF-Objname' for _ in objects['meanra']] - coords.extend(tde_coords) - labels.extend(tde_labels) - if verbose: - print('number of ztf coords added by Objectname:', len(objects['meanra'])) From a795eba8dfc2ece70efe4e5059e87eb48af98036 Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Wed, 3 Jan 2024 22:48:01 -0800 Subject: [PATCH 2/9] use consistent name for radius --- light_curves/code_src/ztf_functions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/light_curves/code_src/ztf_functions.py b/light_curves/code_src/ztf_functions.py index 3ca01ed5..4a118e8a 100644 --- a/light_curves/code_src/ztf_functions.py +++ b/light_curves/code_src/ztf_functions.py @@ -24,7 +24,7 @@ ) -def ZTF_get_lightcurve(sample_table, nworkers=6, ztf_radius=0.000278 * u.deg): +def ZTF_get_lightcurve(sample_table, nworkers=6, match_radius=0.000278 * u.deg): """Function to add the ZTF lightcurves in all three bands to a multiframe data structure. This is the MAIN function. Parameters @@ -35,7 +35,7 @@ def ZTF_get_lightcurve(sample_table, nworkers=6, ztf_radius=0.000278 * u.deg): number of workers in the multiprocessing pool used in the load_lightcurves function. This must be None if this function is being called from within a child process already. (This function does not support nested multiprocessing.) - ztf_radius : astropy Quantity + match_radius : astropy Quantity search radius, how far from the source should the archives return results Returns @@ -45,7 +45,7 @@ def ZTF_get_lightcurve(sample_table, nworkers=6, ztf_radius=0.000278 * u.deg): """ # the catalog is in parquet format with one file per ZTF filter, field, ccd, and quadrant # use a TAP query to locate which files each object is in - locations_df = locate_objects(sample_table, ztf_radius) + locations_df = locate_objects(sample_table, match_radius) # the catalog is stored in an AWS S3 bucket. loop over the files and load the light curves ztf_df = load_lightcurves(locations_df, nworkers=nworkers) @@ -104,7 +104,7 @@ def file_name(filtercode, field, ccdid, qid, basedir=None): return CATALOG_ROOT + f -def locate_objects(sample_table, radius, chunksize=10000): +def locate_objects(sample_table, match_radius, chunksize=10000): """The catalog's parquet files are organized by filter, field, CCD, and quadrant. Use TAP to look them up. https://irsa.ipac.caltech.edu/docs/program_interface/TAP.html @@ -113,9 +113,9 @@ def locate_objects(sample_table, radius, chunksize=10000): ---------- sample_table : `~astropy.table.Table` Table with the coordinates and journal reference labels of the sources - radius : astropy Quantity + match_radius : astropy Quantity search radius, how far from the source should the archives return results - chunksize : int + chunksize : int This tap query is much faster when submitting less than ~10,000 coords at a time so iterate over chunks of coords_tbl and then concat results. @@ -139,7 +139,7 @@ def locate_objects(sample_table, radius, chunksize=10000): query = f"""SELECT {select_cols} FROM ztf_objects_{DATARELEASE} ztf, TAP_UPLOAD.sample sample WHERE CONTAINS( - POINT('ICRS', sample.ra, sample.dec), CIRCLE('ICRS', ztf.ra, ztf.dec, {radius.value}) + POINT('ICRS', sample.ra, sample.dec), CIRCLE('ICRS', ztf.ra, ztf.dec, {match_radius.value}) )=1""" # do the tap calls From 2395da35e1f8c02f61c7afac2f5b67c1462d1b64 Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Wed, 3 Jan 2024 22:49:00 -0800 Subject: [PATCH 3/9] use astropy for unit conversion --- light_curves/code_src/ztf_functions.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/light_curves/code_src/ztf_functions.py b/light_curves/code_src/ztf_functions.py index 4a118e8a..35e6c045 100644 --- a/light_curves/code_src/ztf_functions.py +++ b/light_curves/code_src/ztf_functions.py @@ -309,13 +309,11 @@ def transform_lightcurves(ztf_df): ztf_df = ztf_df.loc[ztf_df["catflags"] < 32768, :] # calc flux [https://arxiv.org/pdf/1902.01872.pdf zeropoint corrections already applied] - magupper = ztf_df["mag"] + ztf_df["magerr"] - maglower = ztf_df["mag"] - ztf_df["magerr"] - flux = 10 ** ((ztf_df["mag"] - 23.9) / -2.5) # uJy - flux_upper = abs(flux - 10 ** ((magupper - 23.9) / -2.5)) - flux_lower = abs(flux - 10 ** ((maglower - 23.9) / -2.5)) - fluxerr = (flux_upper + flux_lower) / 2.0 - ztf_df.loc[:, "flux"] = flux * 1e-3 # now in mJy - ztf_df.loc[:, "err"] = fluxerr * 1e-3 + mag = ztf_df["mag"].to_numpy() + magerr = ztf_df["magerr"].to_numpy() + fluxupper = ((mag - magerr) * u.ABmag).to_value('mJy') + fluxlower = ((mag + magerr) * u.ABmag).to_value('mJy') + ztf_df["flux"] = (mag * u.ABmag).to_value('mJy') + ztf_df["err"] = (fluxupper - fluxlower) / 2 return ztf_df From 83fe7037d2e5e95f38de0a798ac7c6d3b89fdb82 Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Thu, 4 Jan 2024 00:01:02 -0800 Subject: [PATCH 4/9] remove try/except --- light_curves/code_src/panstarrs.py | 68 +++++++++++++----------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/light_curves/code_src/panstarrs.py b/light_curves/code_src/panstarrs.py index ba86a760..a59b8580 100644 --- a/light_curves/code_src/panstarrs.py +++ b/light_curves/code_src/panstarrs.py @@ -256,50 +256,40 @@ def Panstarrs_get_lightcurves(sample_table, radius): lab = row["label"] objectid = row["objectid"] - #sometimes there isn't actually a light curve for the target??? - try: - #see if there is an object in panSTARRS at this location - results = ps1cone(ra,dec,radius,release='dr2') - tab = ascii.read(results) + # see if there is an object in panSTARRS at this location. if not, continue to the next object. + results = ps1cone(ra,dec,radius,release='dr2') + if not results: + continue + tab = ascii.read(results) - # improve the format of the table - tab = improve_filter_format(tab) - - #in case there is more than one object within 1 arcsec, sort them by match distance - tab.sort('distance') + # improve the format of the table + tab = improve_filter_format(tab) - #if there is an object at that location - if len(tab) > 0: - #got a live one - #print( 'for object', ccount + 1, 'there is ',len(tab), 'match in panSTARRS', tab['objID']) + #in case there is more than one object within 1 arcsec, sort them by match distance + tab.sort('distance') - #take the closest match as the best match - objid = tab['objID'][0] - - #get the actual detections and light curve info for this target - dresults = search_lightcurve(objid) - - ascii.read(dresults) - + #take the closest match as the best match + objid = tab['objID'][0] + + #get the actual detections and light curve info for this target + dresults = search_lightcurve(objid) + if not dresults: + continue #fix the column names to include filter names - - dtab = addfilter(ascii.read(dresults)) - - dtab.sort('obsTime') + dtab = addfilter(ascii.read(dresults)) - #here is the light curve mixed from all 5 bands - t_panstarrs = dtab['obsTime'] - flux_panstarrs = dtab['psfFlux']*1E3 # in mJy - err_panstarrs = dtab['psfFluxErr'] *1E3 - filtername = dtab['filter'] - - #put this single object light curves into a pandas multiindex dataframe - dfsingle = pd.DataFrame(dict(flux=flux_panstarrs, err=err_panstarrs, time=t_panstarrs, objectid=objectid, band=filtername, label=lab)).set_index(["objectid","label", "band", "time"]) - #then concatenate each individual df together - df_lc.append(dfsingle) - except FileNotFoundError: - #print("There is no light curve") - pass + dtab.sort('obsTime') + + #here is the light curve mixed from all 5 bands + t_panstarrs = dtab['obsTime'] + flux_panstarrs = dtab['psfFlux']*1E3 # in mJy + err_panstarrs = dtab['psfFluxErr'] *1E3 + filtername = dtab['filter'] + + #put this single object light curves into a pandas multiindex dataframe + dfsingle = pd.DataFrame(dict(flux=flux_panstarrs, err=err_panstarrs, time=t_panstarrs, objectid=objectid, band=filtername, label=lab)).set_index(["objectid","label", "band", "time"]) + #then concatenate each individual df together + df_lc.append(dfsingle) return(df_lc) From 636d4c6bdd460ccc13061a3746d4e2c53ea07505 Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Thu, 4 Jan 2024 11:48:01 -0800 Subject: [PATCH 5/9] replace try/except --- .../code_src/TESS_Kepler_functions.py | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/light_curves/code_src/TESS_Kepler_functions.py b/light_curves/code_src/TESS_Kepler_functions.py index bce1f0ae..0bfefb8d 100644 --- a/light_curves/code_src/TESS_Kepler_functions.py +++ b/light_curves/code_src/TESS_Kepler_functions.py @@ -57,53 +57,53 @@ def TESS_Kepler_get_lightcurves(sample_table, radius): # for testing, this has 79 light curves between the three missions. # for ccount in range(1): # coord = '19:02:43.1 +50:14:28.7' + + # use lightkurve to search TESS, Kepler and K2. if nothing is found, continue to the next object. + # https://docs.lightkurve.org/tutorials/1-getting-started/searching-for-data-products.html + search_result = lk.search_lightcurve(row["coord"], radius = radius) + if not search_result: + continue + + # download all of the returned light curves from TESS, Kepler, and K2 + # results occasionally include an unsupported product and this raises a LightkurveError try: - # use lightkurve to search TESS, Kepler and K2 - search_result = lk.search_lightcurve(row["coord"], radius = radius) - lab = row["label"] + lc_collection = search_result.download_all() + except lk.LightkurveError: + continue - # figure out what to do with the results - if len(search_result) >= 1: - # https://docs.lightkurve.org/tutorials/1-getting-started/searching-for-data-products.html - print(row["objectid"], 'got a live one') - # download all of the returned light curves from TESS, Kepler, and K2 - lc_collection = search_result.download_all() + # can't get the whole collection directly into pandas multiindex + # pull out inidividual light curves, convert to uniform units, and put them in pandas + for numlc in range(len(search_result)): + + lc = lc_collection[numlc] # for testing 0 is Kepler, #69 is TESS - # can't get the whole collection directly into pandas multiindex - # pull out inidividual light curves, convert to uniform units, and put them in pandas - for numlc in range(len(search_result)): - - lc = lc_collection[numlc] # for testing 0 is Kepler, #69 is TESS + # convert to Pandas + lcdf = lc.to_pandas().reset_index() - # convert to Pandas - lcdf = lc.to_pandas().reset_index() - - # these light curves are too highly sampled for our AGN use case, so reduce their size - # by choosing only to keep every nth sample - nsample = 30 - lcdf_small = lcdf[lcdf.index % nsample ==0] # selects every nth row starting with row 0 - - # convert time to mjd - time_lc = lcdf_small.time # in units of time - 2457000 BTJD days - time_lc= time_lc + 2457000 - 2400000.5 # now in MJD days within a few minutes (except for the barycenter correction) + # these light curves are too highly sampled for our AGN use case, so reduce their size + # by choosing only to keep every nth sample + nsample = 30 + lcdf_small = lcdf[lcdf.index % nsample ==0] # selects every nth row starting with row 0 + + # convert time to mjd + time_lc = lcdf_small.time # in units of time - 2457000 BTJD days + time_lc= time_lc + 2457000 - 2400000.5 # now in MJD days within a few minutes (except for the barycenter correction) - # TESS, Kepler, and K2 report flux in units of electrons/s - # there is no good way to convert this to anything more useful because the bandpasses are very wide and nonstandard - # really we don't care about absolute scale, but want to scale the light curve to be on the same plot as other light curves - # save as electron/s here and scale when plotting - flux_lc = lcdf_small.flux #in electron/s - fluxerr_lc = lcdf_small.flux_err #in electron/s + # TESS, Kepler, and K2 report flux in units of electrons/s + # there is no good way to convert this to anything more useful because the bandpasses are very wide and nonstandard + # really we don't care about absolute scale, but want to scale the light curve to be on the same plot as other light curves + # save as electron/s here and scale when plotting + flux_lc = lcdf_small.flux #in electron/s + fluxerr_lc = lcdf_small.flux_err #in electron/s - # record band name - filtername = clean_filternames(search_result, numlc) + # record band name + filtername = clean_filternames(search_result, numlc) - # put this single object light curves into a pandas multiindex dataframe - # fluxes are in units of electrons/s and will be scaled to fit the other fluxes when plotting - dfsingle = pd.DataFrame(dict(flux=flux_lc, err=fluxerr_lc, time=time_lc, objectid=row["objectid"], band=filtername,label=lab)).set_index(["objectid", "label", "band", "time"]) - - # then concatenate each individual df together - df_lc.append(dfsingle) - except: - pass + # put this single object light curves into a pandas multiindex dataframe + # fluxes are in units of electrons/s and will be scaled to fit the other fluxes when plotting + dfsingle = pd.DataFrame(dict(flux=flux_lc, err=fluxerr_lc, time=time_lc, objectid=row["objectid"], band=filtername,label=row["label"])).set_index(["objectid", "label", "band", "time"]) + + # then concatenate each individual df together + df_lc.append(dfsingle) return(df_lc) From 4c883b06d6519470fa9bb4d0c2d1c1cbac823188 Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Thu, 4 Jan 2024 12:08:42 -0800 Subject: [PATCH 6/9] iterate over lightcurves instead of index --- light_curves/code_src/TESS_Kepler_functions.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/light_curves/code_src/TESS_Kepler_functions.py b/light_curves/code_src/TESS_Kepler_functions.py index 0bfefb8d..d5e1c6e4 100644 --- a/light_curves/code_src/TESS_Kepler_functions.py +++ b/light_curves/code_src/TESS_Kepler_functions.py @@ -4,7 +4,7 @@ from data_structures import MultiIndexDFObject -def clean_filternames(search_result, numlc): +def clean_filternames(lightcurve): """Simplify mission name from a combined list Mission names are returned including quarter numbers, remove those to @@ -23,7 +23,7 @@ def clean_filternames(search_result, numlc): filtername : str name of the mission without quarter information """ - filtername = str(search_result[numlc].mission) + filtername = lightcurve.mission # clean this up a bit so all Kepler quarters etc., get the same filtername # we don't need to track the individual names for the quarters, just need to know which mission it is if 'Kepler' in filtername: @@ -73,12 +73,10 @@ def TESS_Kepler_get_lightcurves(sample_table, radius): # can't get the whole collection directly into pandas multiindex # pull out inidividual light curves, convert to uniform units, and put them in pandas - for numlc in range(len(search_result)): - - lc = lc_collection[numlc] # for testing 0 is Kepler, #69 is TESS + for lightcurve in lc_collection: # for testing 0 is Kepler, #69 is TESS # convert to Pandas - lcdf = lc.to_pandas().reset_index() + lcdf = lightcurve.to_pandas().reset_index() # these light curves are too highly sampled for our AGN use case, so reduce their size # by choosing only to keep every nth sample @@ -97,7 +95,7 @@ def TESS_Kepler_get_lightcurves(sample_table, radius): fluxerr_lc = lcdf_small.flux_err #in electron/s # record band name - filtername = clean_filternames(search_result, numlc) + filtername = clean_filternames(lightcurve) # put this single object light curves into a pandas multiindex dataframe # fluxes are in units of electrons/s and will be scaled to fit the other fluxes when plotting From eac04c620bc702e2759e3306e66dfaac0d4c40ec Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Thu, 4 Jan 2024 15:57:27 -0800 Subject: [PATCH 7/9] replace catalog and error lists with dict --- light_curves/code_src/heasarc_functions.py | 27 +++++++++------------- light_curves/light_curve_generator.md | 16 ++++++------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/light_curves/code_src/heasarc_functions.py b/light_curves/code_src/heasarc_functions.py index 44b60b97..ed2c3b4e 100644 --- a/light_curves/code_src/heasarc_functions.py +++ b/light_curves/code_src/heasarc_functions.py @@ -56,23 +56,18 @@ def make_hist_error_radii(missioncat): return heasarcresulttable -def HEASARC_get_lightcurves(sample_table, heasarc_cat, max_error_radius): +def HEASARC_get_lightcurves(sample_table, catalog_error_radii): """Searches HEASARC archive for light curves from a specific list of mission catalogs Parameters ---------- sample_table : `~astropy.table.Table` Table with the coordinates and journal reference labels of the sources - heasarc_cat : str list - list of catalogs within HEASARC to search for light curves. Must be one of the catalogs listed here: - https://astroquery.readthedocs.io/en/latest/heasarc/heasarc.html#getting-list-of-available-missions - max_error_radius : flt list - maximum error radius to include in the returned catalog of objects - ie., we are not interested in GRBs with a 90degree error radius because they will fit all of our objects - xmlfilename: str - filename which has the list of sources to cross match with HEASARC catalogs - must be a VOTable in xml format - generated by `make_VOTable` functiom + catalog_error_radii : dict + Catalogs to query and their corresponding max error radii. Dictionary key must be one of the tables listed + here: https://astroquery.readthedocs.io/en/latest/heasarc/heasarc.html#getting-list-of-available-missions. + Value must be the maximum error radius to include in the returned catalog of objects (ie., we are not + interested in GRBs with a 90degree error radius because they will fit all of our objects). Returns ------- @@ -96,14 +91,14 @@ def HEASARC_get_lightcurves(sample_table, heasarc_cat, max_error_radius): heasarc_tap = pyvo.regsearch(servicetype='tap', keywords=['heasarc'])[0] # Note that the astropy table is uploaded when we run the query with run_sync - for m in tqdm(range(len(heasarc_cat))): - print('working on mission', heasarc_cat[m]) + for heasarc_cat, max_error_radius in tqdm(catalog_error_radii.items()): + print('working on mission', heasarc_cat) hquery = f""" SELECT cat.name, cat.ra, cat.dec, cat.error_radius, cat.time, mt.objectid, mt.label - FROM {heasarc_cat[m]} cat, tap_upload.mytable mt + FROM {heasarc_cat} cat, tap_upload.mytable mt WHERE - cat.error_radius < {max_error_radius[m]} AND + cat.error_radius < {max_error_radius} AND CONTAINS(POINT('ICRS',mt.ra,mt.dec),CIRCLE('ICRS',cat.ra,cat.dec,cat.error_radius))=1 """ @@ -126,7 +121,7 @@ def HEASARC_get_lightcurves(sample_table, heasarc_cat, max_error_radius): #so making up a flux and an error, but the time stamp and mission are the real variables we want to keep df_heasarc = pd.DataFrame(dict(flux=np.full(len(hresulttable), 0.1), err=np.full(len(hresulttable), 0.1), time=hresulttable['time'], objectid=hresulttable['objectid'], - band=np.full(len(hresulttable), heasarc_cat[m]), + band=np.full(len(hresulttable), heasarc_cat), label=hresulttable['label'])).set_index(["objectid", "label", "band", "time"]) # Append to existing MultiIndex light curve object diff --git a/light_curves/light_curve_generator.md b/light_curves/light_curve_generator.md index b2243d1f..f4fc4577 100644 --- a/light_curves/light_curve_generator.md +++ b/light_curves/light_curve_generator.md @@ -189,15 +189,14 @@ heasarcstarttime = time.time() max_fermi_error_radius = str(1.0) max_sax_error_radius = str(3.0) -# List of missions to query and their corresponding error radii -heasarc_cat = ["FERMIGTRIG", "SAXGRBMGRB"] -error_radius = [max_fermi_error_radius , max_sax_error_radius] +# catalogs to query and their corresponding max error radii +heasarc_catalogs = {"FERMIGTRIG": max_fermi_error_radius, "SAXGRBMGRB": max_sax_error_radius} -# get heasarc light curves in the above curated list of missions -df_lc_fermi = HEASARC_get_lightcurves(sample_table, heasarc_cat, error_radius) +# get heasarc light curves in the above curated list of catalogs +df_lc_HEASARC = HEASARC_get_lightcurves(sample_table, heasarc_catalogs) # add the resulting dataframe to all other archives -df_lc.append(df_lc_fermi) +df_lc.append(df_lc_HEASARC) print('heasarc search took:', time.time() - heasarcstarttime, 's') ``` @@ -341,8 +340,7 @@ print('total time for serial archive calls is ', end_serial - start_serial, 's') # define some variables in case the above serial cells are not run max_fermi_error_radius = str(1.0) max_sax_error_radius = str(3.0) -heasarc_cat = ["FERMIGTRIG", "SAXGRBMGRB"] -error_radius = [max_fermi_error_radius , max_sax_error_radius] +heasarc_catalogs = {"FERMIGTRIG": max_fermi_error_radius, "SAXGRBMGRB": max_sax_error_radius} bandlist = ["W1", "W2"] wise_radius = 1.0 * u.arcsec panstarrs_radius = 1.0 / 3600.0 # search radius = 1 arcsec @@ -384,7 +382,7 @@ with mp.Pool(processes=n_workers) as pool: Gaia_get_lightcurve, (sample_table, 1/3600., 0), callback=callback ) pool.apply_async( - HEASARC_get_lightcurves, (sample_table, heasarc_cat, error_radius), callback=callback + HEASARC_get_lightcurves, (sample_table, heasarc_catalogs), callback=callback ) pool.apply_async( HCV_get_lightcurves, (sample_table, hcv_radius), callback=callback From 34a9296e1e8d35a56b5b91ec3b31bfefa6131eb3 Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Wed, 10 Jan 2024 23:31:23 -0800 Subject: [PATCH 8/9] replace ascii.read with Table.read --- light_curves/code_src/panstarrs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/light_curves/code_src/panstarrs.py b/light_curves/code_src/panstarrs.py index a59b8580..51d47d8f 100644 --- a/light_curves/code_src/panstarrs.py +++ b/light_curves/code_src/panstarrs.py @@ -1,7 +1,6 @@ import numpy as np import pandas as pd import requests -from astropy.io import ascii from astropy.table import Table from tqdm import tqdm @@ -260,7 +259,7 @@ def Panstarrs_get_lightcurves(sample_table, radius): results = ps1cone(ra,dec,radius,release='dr2') if not results: continue - tab = ascii.read(results) + tab = Table.read(results, format='ascii') # improve the format of the table tab = improve_filter_format(tab) @@ -277,7 +276,7 @@ def Panstarrs_get_lightcurves(sample_table, radius): continue #fix the column names to include filter names - dtab = addfilter(ascii.read(dresults)) + dtab = addfilter(Table.read(dresults, format='ascii')) dtab.sort('obsTime') From dd617e0404bf80f3d67acf8dcca7414d5e665d47 Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Wed, 10 Jan 2024 23:31:41 -0800 Subject: [PATCH 9/9] update docstring --- light_curves/code_src/TESS_Kepler_functions.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/light_curves/code_src/TESS_Kepler_functions.py b/light_curves/code_src/TESS_Kepler_functions.py index d5e1c6e4..51b50f16 100644 --- a/light_curves/code_src/TESS_Kepler_functions.py +++ b/light_curves/code_src/TESS_Kepler_functions.py @@ -13,10 +13,8 @@ def clean_filternames(lightcurve): Parameters ---------- - search_result : lightkurve object + lightcurve : lightkurve result object detailing the light curve object found with lightkurve - numlc : int - index of the light curve we are working on Returns -------