Skip to content

Commit

Permalink
fix apass sdss filter bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mfitzasp committed May 28, 2024
1 parent 83fcf76 commit 69bd90c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 5 additions & 2 deletions astrosource/astrosource.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self, targets, indir, **kwargs):
self.starreject = kwargs.get('starreject', 0.3)
self.nopanstarrs = kwargs.get('nopanstarrs', False)
self.nosdss = kwargs.get('nosdss', False)
self.noskymapper = kwargs.get('noskymapper', False)
self.closerejectd = kwargs.get('closerejectd', 5.0)
self.targetradius = kwargs.get('targetradius', 1.5)
self.matchradius = kwargs.get('matchradius', 1.0)
Expand Down Expand Up @@ -123,7 +124,8 @@ def analyse(self, calib=True, usescreenedcomps=False, usecompsused=False, usecom
paths=self.paths,
fileList=self.files,
nopanstarrs=self.nopanstarrs,
nosdss=self.nosdss,
nosdss=self.nosdss,
noskymapper=self.noskymapper,
closerejectd=self.closerejectd,
photCoords=self.photCoords,
photFileHolder=self.photFileHolder,
Expand Down Expand Up @@ -180,7 +182,8 @@ def analyse(self, calib=True, usescreenedcomps=False, usecompsused=False, usecom
filterCode=self.filtercode,
paths=self.paths,
nopanstarrs=self.nopanstarrs,
nosdss=self.nosdss,
nosdss=self.nosdss,
noskymapper=self.noskymapper,
closerejectd=self.closerejectd,
colourdetect=self.colourdetect,
linearise=self.linearise,
Expand Down
14 changes: 12 additions & 2 deletions astrosource/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ def catalogue_call(avgCoord, radius, opt, cat_name, targets, closerejectd):
radecname = {'ra' :'raj2000', 'dec': 'dej2000'}

if cat_name in ['APASS']:
searchColumns=[radecname['ra'], radecname['dec'], opt['filter'], opt['error'].replace('e_i_mag','e_i\'mag').replace('e_r_mag','e_r\'mag').replace('e_g_mag','e_g\'mag'), opt['colmatch'], opt['colerr'].replace('e_i_mag','e_i\'mag').replace('e_r_mag','e_r\'mag').replace('e_g_mag','e_g\'mag')]
searchColumns=[]
#searchColumns=[radecname['ra'], radecname['dec'], 'i_mag', opt['filter'].replace('i_mag','i\'mag').replace('r_mag','r\'mag').replace('g_mag','g\'mag'), opt['error'].replace('e_i_mag','e_i\'mag').replace('e_r_mag','e_r\'mag').replace('e_g_mag','e_g\'mag'), opt['colmatch'].replace('i_mag','i\'mag').replace('r_mag','r\'mag').replace('g_mag','g\'mag'), opt['colerr'].replace('e_i_mag','e_i\'mag').replace('e_r_mag','e_r\'mag').replace('e_g_mag','e_g\'mag')]
#print (searchColumns)
else:
searchColumns=[radecname['ra'], radecname['dec'], opt['filter'], opt['error'], opt['colmatch'], opt['colerr']]
Expand Down Expand Up @@ -653,6 +654,13 @@ def catalogue_call(avgCoord, radius, opt, cat_name, targets, closerejectd):

if len(resp) != 0:
catReject=[]

# v=Vizier() # Skymapper by default does not report the error columns
# v.ROW_LIMIT=-1
# query = v.query_region(avgCoord, column_filters=queryConstraint, **kwargs)
# resp = query[tbname]

#breakpoint()

for q in range(len(resp)):
if np.asarray(resp[opt['filter']][q]) == 0.0 or np.asarray(resp[opt['error']][q]) == 0.0 or np.isnan(resp[opt['filter']][q]) or np.isnan(resp[opt['error']][q]):
Expand Down Expand Up @@ -693,7 +701,7 @@ def catalogue_call(avgCoord, radius, opt, cat_name, targets, closerejectd):

return data

def find_comparisons_calibrated(targets, paths, filterCode, nopanstarrs=False, nosdss=False, colourdetect=False, linearise=False, closerejectd=5.0, max_magerr=0.05, stdMultiplier=2, variabilityMultiplier=2, colourTerm=0.0, colourError=0.0, restrictmagbrightest=-99.9, restrictmagdimmest=99.9, restrictcompcolourcentre=-99.0, restrictcompcolourrange=-99.0, photCoordsFile=None, photFileHolder=None, calibSave=False):
def find_comparisons_calibrated(targets, paths, filterCode, nopanstarrs=False, nosdss=False, noskymapper=False, colourdetect=False, linearise=False, closerejectd=5.0, max_magerr=0.05, stdMultiplier=2, variabilityMultiplier=2, colourTerm=0.0, colourError=0.0, restrictmagbrightest=-99.9, restrictmagdimmest=99.9, restrictcompcolourcentre=-99.0, restrictcompcolourrange=-99.0, photCoordsFile=None, photFileHolder=None, calibSave=False):


sys.stdout.write("⭐️ Find comparison stars in catalogues for calibrated photometry\n")
Expand Down Expand Up @@ -806,6 +814,8 @@ def find_comparisons_calibrated(targets, paths, filterCode, nopanstarrs=False, n
logger.info("Skipping PanSTARRS")
elif cat_name == 'SDSS' and nosdss==True:
logger.info("Skipping SDSS")
elif cat_name == 'SkyMapper' and noskymapper==True:
logger.info("Skipping Skymapper")
else:

coords = catalogue_call(avgCoord, 1.5*radius, opt, cat_name, targets=targets, closerejectd=closerejectd)
Expand Down
2 changes: 1 addition & 1 deletion astrosource/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def gather_files(paths, filelist=None, filetype="fz", bjd=False, ignoreedgefract

return phot_list, filterCode, photFileHolder, photSkyCoord

def find_stars(targets, paths, fileList, nopanstarrs=False, nosdss=False, closerejectd=5.0, photCoords=None, photFileHolder=None, mincompstars=0.1, mincompstarstotal=-99, starreject=0.1 , acceptDistance=1.0, lowcounts=2000, hicounts=3000000, imageFracReject=0.0, rejectStart=3, maxcandidatestars=10000, restrictcompcolourcentre=-99.0, restrictcompcolourrange=-99.0, filterCode=None, restrictmagbrightest=-99.0, restrictmagdimmest=99.0, minfractionimages=0.5):
def find_stars(targets, paths, fileList, nopanstarrs=False, nosdss=False, noskymapper=False,closerejectd=5.0, photCoords=None, photFileHolder=None, mincompstars=0.1, mincompstarstotal=-99, starreject=0.1 , acceptDistance=1.0, lowcounts=2000, hicounts=3000000, imageFracReject=0.0, rejectStart=3, maxcandidatestars=10000, restrictcompcolourcentre=-99.0, restrictcompcolourrange=-99.0, filterCode=None, restrictmagbrightest=-99.0, restrictmagdimmest=99.0, minfractionimages=0.5):
"""
Finds stars useful for photometry in each photometry/data file
Expand Down
4 changes: 3 additions & 1 deletion astrosource/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
@click.option('--maxcandidatestars', type=float, default=10000, help='Maximum number of candidate stars to begin search with')
@click.option('--nopanstarrs', is_flag=True, help='Do not use the PanSTARRS catalogue for calibration')
@click.option('--nosdss', is_flag=True, help='Do not use the SDSS catalogue for calibration')
@click.option('--noskymapper', is_flag=True, help='Do not use the Skymapper catalogue for calibration')
@click.option('--varsearch', is_flag=True, help='Undertake variability calculations for identified stars')

@click.option('--varsearchglobalstdev', type=float, default=-99.9, help='Just detect variables above a certain variability not variability by magnitude')
Expand Down Expand Up @@ -113,7 +114,7 @@ def main(full, stars, comparison, variablehunt, notarget, lowestcounts, usescree
varsearchminimages, ignoreedgefraction, usecompsused, usecompletedcalib, mincompstarstotal, calc, \
calib, phot, plot, detrend, eebls, period, indir, ra, dec, target_file, format, imgreject, \
mincompstars, maxcandidatestars, closerejectd, bjd, clean, verbose, debug, periodlower, periodupper, \
periodtests, thresholdcounts, nopanstarrs, nosdss, varsearch, varsearchthresh, starreject, hicounts, \
periodtests, thresholdcounts, nopanstarrs, nosdss, noskymapper, varsearch, varsearchthresh, starreject, hicounts, \
lowcounts, colourdetect, linearise, colourterm, colourerror, targetcolour, restrictmagbrightest, \
restrictmagdimmest, rejectmagbrightest, rejectmagdimmest,targetradius, matchradius, racut, deccut, \
radiuscut, restrictcompcolourcentre, restrictcompcolourrange, detrendfraction, minfractionimages):
Expand Down Expand Up @@ -164,6 +165,7 @@ def main(full, stars, comparison, variablehunt, notarget, lowestcounts, usescree
starreject=starreject,
nopanstarrs=nopanstarrs,
nosdss=nosdss,
noskymapper=noskymapper,
closerejectd=closerejectd,
maxcandidatestars=maxcandidatestars,
verbose=verbose,
Expand Down

0 comments on commit 69bd90c

Please sign in to comment.