def check_sensitivity(): fileList = [] for arg in sys.argv[1:]: if 1: fileList.append(arg) badregions = Search_slow.badregions interp_regions = Search_slow.interp_regions trimsize = Search_slow.trimsize prim_vsini = StarData.get_vsini(fileList) Sensitivity.Analyze( fileList, prim_vsini, hdf5_file="/media/ExtraSpace/PhoenixGrid/TS23_Grid.hdf5", extensions=True, resolution=None, trimsize=trimsize, badregions=badregions, interp_regions=interp_regions, metal_values=(0.0,), vsini_values=(100, 150, 200, 250), Tvalues=range(7000, 12100, 1000), debug=False, addmode="all", output_mode="hdf5", output_file="Sensitivity.hdf5", )
def check_sensitivity(): fileList = [] for arg in sys.argv[1:]: if 1: fileList.append(arg) badregions = Search_slow.badregions interp_regions = Search_slow.interp_regions trimsize = Search_slow.trimsize prim_vsini = StarData.get_vsini(fileList) # Remove anything without a vsini new_file_list = [] new_prim_vsini = [] for vsini, fname in zip(prim_vsini, fileList): if vsini is not None: new_file_list.append(fname) new_prim_vsini.append(vsini) Sensitivity.Analyze(new_file_list, new_prim_vsini, hdf5_file='/media/ExtraSpace/PhoenixGrid/IGRINS_Grid.hdf5', extensions=True, resolution=None, trimsize=trimsize, badregions=badregions, interp_regions=interp_regions, metal_values=(0.0,), vsini_values=(75, 100, 125, 150, 175, 200, 225, 250), Tvalues=range(3000, 3300, 100), debug=False, addmode='all', output_mode='hdf5', output_file='Sensitivity.hdf5')
def check_sensitivity(): fileList = [] for arg in sys.argv[1:]: if 1: fileList.append(arg) badregions = Search_slow.badregions interp_regions = Search_slow.interp_regions trimsize = Search_slow.trimsize prim_vsini = StarData.get_vsini(fileList, vsini_filename='../Useful_Datafiles/Vsini.csv') Sensitivity.Analyze(fileList, prim_vsini, hdf5_file='/media/ExtraSpace/PhoenixGrid/CHIRON_Grid.hdf5', extensions=True, resolution=None, trimsize=trimsize, badregions=badregions, interp_regions=interp_regions, metal_values=(0.0,), #vsini_values=(0, 10, 20, 30, 40, 50), #Tvalues=range(4000, 6000, 100), vsini_values=(40,), Tvalues=(3600,), debug=False, addmode='all', output_mode='hdf5')
def query(self, corner1, corner2, corner3, corner4): """ Queries the database for stars within an area. @param corner1 [in] The first corner of the sensor defined as (RA, Decl). @param corner2 [in] The second corner of the sensor defined as (RA, Decl). @param corner3 [in] The third corner of the sensor defined as (RA, Decl). @param corner4 [in] The fourth corner of the sensor defined as (RA, Decl). """ ra = [corner1[0], corner2[0], corner3[0], corner4[0]] decl = [corner1[1], corner2[1], corner3[1], corner4[1]] top = max(decl) bottom = min(decl) left = min(ra) right = max(ra) raStddev = numpy.std(ra) if raStddev >= stddevSplit: left = max([x for x in ra if x < 180]) right = min([x for x in ra if x >= 180]) above0Set = self.queryInternal(top, bottom, 0, left) below0Set = self.queryInternal(top, bottom, right, 360) return StarData.StarData( above0Set.RA + below0Set.RA, above0Set.Decl + below0Set.Decl, above0Set.ObsMagU + below0Set.ObsMagU, above0Set.ObsMagUNew + below0Set.ObsMagUNew, above0Set.LSSTMagU + below0Set.LSSTMagU, above0Set.LSSTMagUNoATM + below0Set.LSSTMagUNoATM, above0Set.ObsMagG + below0Set.ObsMagG, above0Set.ObsMagGNew + below0Set.ObsMagGNew, above0Set.LSSTMagG + below0Set.LSSTMagG, above0Set.LSSTMagGNoATM + below0Set.LSSTMagGNoATM, above0Set.ObsMagR + below0Set.ObsMagR, above0Set.ObsMagRNew + below0Set.ObsMagRNew, above0Set.LSSTMagR + below0Set.LSSTMagR, above0Set.LSSTMagRNoATM + below0Set.LSSTMagRNoATM, above0Set.ObsMagI + below0Set.ObsMagI, above0Set.ObsMagINew + below0Set.ObsMagINew, above0Set.LSSTMagI + below0Set.LSSTMagI, above0Set.LSSTMagINoATM + below0Set.LSSTMagINoATM, above0Set.ObsMagZ + below0Set.ObsMagZ, above0Set.ObsMagZNew + below0Set.ObsMagZNew, above0Set.LSSTMagZ + below0Set.LSSTMagZ, above0Set.LSSTMagZNoATM + below0Set.LSSTMagZNoATM, above0Set.ObsMagY + below0Set.ObsMagY, above0Set.ObsMagYNew + below0Set.ObsMagYNew, above0Set.LSSTMagY + below0Set.LSSTMagY, above0Set.LSSTMagYNoATM + below0Set.LSSTMagYNoATM) else: return self.queryInternal(top, bottom, left, right)
def get_followup(): import os import StarData # Read in the observed target list filename = '{}/Dropbox/School/Research/AstarStuff/TargetLists/Observed_Targets3.xls'.format( os.environ['HOME']) sample = pd.read_excel(filename, sheetname=0, na_values=[' ~']) sample = sample.reset_index(drop=True)[1:] sample['Mag K'] = sample.apply( lambda row: row['Mag K'] if pd.notnull(row['Mag K']) else row['Mag V'], axis=1) # Get the targets with a detection detections = sample.loc[sample['Detections'].notnull()] # Get the detections without follow-up followup = detections.groupby('identifier').filter( lambda df: df.shape[0] == 1) followup.reset_index(inplace=True, drop=True) # Split RA/DEC field radec = followup['RA/DEC (J2000)'].map(Split_RA_DEC) followup['RA'] = radec.map(lambda l: l[0]) followup['DEC'] = radec.map(lambda l: l[1]) # Rename columns followup.rename(columns={ 'Mag K': 'mag', 'identifier': 'Target' }, inplace=True) # Add the spectral type from simbad (not in the table for some silly reason) followup['spectype'] = followup['Target'].map( lambda star: StarData.GetData(star).spectype) followup['spt'] = followup.apply( lambda row: '{} + {}'.format(row['spectype'], row['Detections']), axis=1) return followup
def check_sensitivity(): fileList = [] for arg in sys.argv[1:]: if 1: fileList.append(arg) badregions = Search_slow.badregions interp_regions = Search_slow.interp_regions trimsize = Search_slow.trimsize prim_vsini = StarData.get_vsini(fileList) Sensitivity.Analyze(fileList, prim_vsini, hdf5_file=hdf5_filename, extensions=True, resolution=None, trimsize=trimsize, badregions=badregions, interp_regions=interp_regions, metal_values=(0.0,), vsini_values=(0, 10, 20, 30, 40, 50), Tvalues=range(5200, 7000, 100), debug=False, addmode='all', output_mode='hdf5')
modeldir = "/media/FreeAgent_Drive/SyntheticSpectra/Sorted/Stellar/Vband/" hdf5_filename = "/media/ExtraSpace/PhoenixGrid/HRS_Grid.hdf5" else: modeldir = raw_input("sys.platform not recognized. Please enter model directory below: ") if not modeldir.endswith("/"): modeldir = modeldir + "/" if __name__ == "__main__": # Parse command line arguments: fileList = [] for arg in sys.argv[1:]: if 1: fileList.append(arg) # Get the primary star vsini values prim_vsini = StarData.get_vsini(fileList) GenericSearch.slow_companion_search( fileList, prim_vsini, hdf5_file=hdf5_filename, extensions=True, resolution=None, trimsize=trimsize, modeldir=modeldir, badregions=badregions, metal_values=(0.0, -0.5, 0.5), vsini_values=(1, 5.0, 10.0, 20.0, 30.0), Tvalues=range(3000, 9000, 100), observatory="McDonald", debug=False,
def setUp(self): self.stars = StarData.StarData([100, 200, 300], [1, 2, 3], [4, 5, 6], [7, 8, 9], [7, 8, 9]) self.stars.populateDetector("Foobar") self.survey = SkyCoverageSurvey()
def queryInternal(self, top, bottom, left, right): """ Queries the database for stars within an area. @param top [in] The top edge of the box (Decl). @param bottom [in] The bottom edge of the box (Decl). @param left [in] The left edge of the box (RA). @param right [in] The right edge of the box (RA). """ query = "SELECT ra, decl, sdssu, newSDSSu, umag, umag_noatm, sdssg, newSDSSg, gmag, gmag_noatm, sdssr, newSDSSr, rmag, rmag_noatm, sdssi, newSDSSi, imag, imag_noatm, sdssz, newSDSSz, zmag, zmag_noatm, ymag, ymag_noatm FROM bright_stars WHERE decl <= %f AND decl >= %f AND ra >= %f AND ra <= %f" % ( top, bottom, left, right) self.cursor.execute(query) ra = [] decl = [] obsMagU = [] obsMagUNew = [] lsstMagU = [] lsstMagUNoATM = [] obsMagG = [] obsMagGNew = [] lsstMagG = [] lsstMagGNoATM = [] obsMagR = [] obsMagRNew = [] lsstMagR = [] lsstMagRNoATM = [] obsMagI = [] obsMagINew = [] lsstMagI = [] lsstMagINoATM = [] obsMagZ = [] obsMagZNew = [] lsstMagZ = [] lsstMagZNoATM = [] obsMagY = [] obsMagYNew = [] lsstMagY = [] lsstMagYNoATM = [] for item in self.cursor.fetchall(): ra.append(item[0]) decl.append(item[1]) obsMagU.append(item[2]) obsMagUNew.append(item[3]) lsstMagU.append(item[4]) lsstMagUNoATM.append(item[5]) obsMagG.append(item[6]) obsMagGNew.append(item[7]) lsstMagG.append(item[8]) lsstMagGNoATM.append(item[9]) obsMagR.append(item[10]) obsMagRNew.append(item[11]) lsstMagR.append(item[12]) lsstMagRNoATM.append(item[13]) obsMagI.append(item[14]) obsMagINew.append(item[15]) lsstMagI.append(item[16]) lsstMagINoATM.append(item[17]) obsMagZ.append(item[18]) obsMagZNew.append(item[19]) lsstMagZ.append(item[20]) lsstMagZNoATM.append(item[21]) obsMagY.append(-99) obsMagYNew.append(-99) lsstMagY.append(item[22]) lsstMagYNoATM.append(item[23]) return StarData.StarData(ra, decl, obsMagU, obsMagUNew, lsstMagU, lsstMagUNoATM, obsMagG, obsMagGNew, lsstMagG, lsstMagGNoATM, obsMagR, obsMagRNew, lsstMagR, lsstMagRNoATM, obsMagI, obsMagINew, lsstMagI, lsstMagINoATM, obsMagZ, obsMagZNew, lsstMagZ, lsstMagZNoATM, obsMagY, obsMagYNew, lsstMagY, lsstMagYNoATM)