def _in_region(pos): """Returns a list of booleans.""" positions = _parse_pos(pos) return [ c9.inMicrolensRegion(poscrd.ra.deg, poscrd.dec.deg) for poscrd in positions ]
def check_in_superstamp( target ): (ra, dec) = target.get_location() if ra == None or dec == None: print target.summary([]) exit() result = c9.inMicrolensRegion(ra, dec) return result
def checkMicrolensRegion(RA_string, Dec_string): """Check if strings RA and Dec coordinates are within K2 Campaign 9 microlensing region (units: degrees).""" # Convert strings to floats and output to logger RA = float(RA_string) Dec = float(Dec_string) logger.info("RA: " + str(RA) + " Dec: " + str(Dec) + " (Units: Degrees)") # pass to K2fov.c9 module method (from the K2 tools) to get whether coordinates are in the region return inMicrolensRegion(RA, Dec)
'dc_col'), comment='#') targetlist_doug.to_csv('input/late_targets_K2C9b_v2_morc.dat.csv') targetlist = targetlist_radek.join(targetlist_doug) targetlist.to_csv('input/c9b-targetlist.csv') ################ # SANITY CHECKS ################ # Ensure both targetlists had the same target on each row assert (np.all((targetlist.ra - targetlist.dc_ra) == 0.0)) assert (np.all((targetlist.dec - targetlist.dc_dec) == 0.0)) # Ensure both targetlists agree on the CCD channel assert (np.all((targetlist.k2fov_channel - targetlist.dc_channel) == 0)) # K2fov is expected to be accurate to within 10px delta = np.hypot(targetlist.k2fov_col - targetlist.dc_col, targetlist.k2fov_row - targetlist.dc_row) assert (np.all(delta < 10)) print("Pixel conversion offset: " "median {:.2f}, min {:.2f}, max {:.2f}".format(delta.median(), delta.min(), delta.max())) # Are targets already in the microlensing region? from K2fov import c9 for target in targetlist.itertuples(): if c9.inMicrolensRegion(target.ra, target.dec, padding=5): print("Warning: {} already in superstamp".format(target.name))
def _in_region(pos): """Returns a list of booleans.""" positions = _parse_pos(pos) return [c9.inMicrolensRegion(poscrd.ra.deg, poscrd.dec.deg) for poscrd in positions]
names=('dc_ra', 'dc_dec', 'dc_module', 'dc_output', 'dc_channel', 'dc_row', 'dc_col'), comment='#') targetlist_doug.to_csv('input/late_targets_K2C9b_v2_morc.dat.csv') targetlist = targetlist_radek.join(targetlist_doug) targetlist.to_csv('input/c9b-targetlist.csv') ################ # SANITY CHECKS ################ # Ensure both targetlists had the same target on each row assert(np.all((targetlist.ra - targetlist.dc_ra) == 0.0)) assert(np.all((targetlist.dec - targetlist.dc_dec) == 0.0)) # Ensure both targetlists agree on the CCD channel assert(np.all((targetlist.k2fov_channel - targetlist.dc_channel) == 0)) # K2fov is expected to be accurate to within 10px delta = np.hypot(targetlist.k2fov_col - targetlist.dc_col, targetlist.k2fov_row - targetlist.dc_row) assert(np.all(delta < 10)) print("Pixel conversion offset: " "median {:.2f}, min {:.2f}, max {:.2f}".format(delta.median(), delta.min(), delta.max())) # Are targets already in the microlensing region? from K2fov import c9 for target in targetlist.itertuples(): if c9.inMicrolensRegion(target.ra, target.dec, padding=5): print("Warning: {} already in superstamp".format(target.name))
""" Removes points which are not on the K2C9 superstamp. """ import sys from K2fov.c9 import inMicrolensRegion with open(sys.argv[1]) as data: lines = data.readlines() for line in lines: ra = float(line.split()[1]) dec = float(line.split()[2]) if inMicrolensRegion(ra, dec): print(line[:-1])