#randomise RA and Dec between 0,2pi and -pi/2, pi/2 respectively ##adjusted to smaller ranges to see if improves results sourcealpha[i] = 2*np.pi*(r.uniform(0,1)) sourcedelta[i] = np.arccos(2*(r.uniform(0,1))-1)-np.pi/2 #performs barycentring functions for source i emit = get_bary_in_loop(tGPS, detector,[sourcealpha[i], sourcedelta[i]], Eephem, Sephem) #creates training vectors of time difference [emitdt, emitte, emitdd, emitR, emitER, emitE, emitS] = emit TS[i]= np.reshape(emitdt, wl) ## normalises training vectors TS[i] /= np.sqrt(np.abs(greedy.dot_product(dt, TS[i], TS[i]))) #print[i] ##print('outloop') # tolerance for stopping algorithm tol = 1e-12 #forms normalised basis vectors, except happens far too quickly to be right RB = greedy.greedy(TS, dt, tol) ##### Test this RB can span all random points sourcealpha2 = np.zeros(10) sourcedelta2 = np.zeros(10)
def greedy_bary(detector, tssize, wl, source, tGPS, Eephem, Sephem, dt): """ Generates emitdt data for sources and detector input. Creates Reduced Basis for this using modified Gram-Schmidt process. detector should be case insensitive string matching one of the below abbreviations GREEN BANK = 'GB' NARRABRI CS08 = 'NA' ARECIBO XYZ (JPL) = 'AO' Hobart, Tasmania = 'HO' DSS 43 XYZ = 'TD' PARKES XYZ (JER) = 'PK' JODRELL BANK = 'JB' GB 300FT = 'G3' GB 140FT = 'G1RAD' (changed to distinguish it from GEO) VLA XYZ = 'VL' Nancay = 'NC' Effelsberg = 'EF' GW telescopes): LIGO Hanford = 'LHO', 'H1', 'H2' LIGO Livingston = 'LLO', 'L1' GEO 600 = 'GEO', 'G1' VIRGO = 'V1', 'VIRGO' TAMA = 'T1', 'TAMA' Earth geocentre = 'GEOCENTER' tssize is number of training sets, integer wl is length of training set, integer source = [sourcealpha, sourcedelta], sourcealpha 1d array of right ascension, length wl sourcedelta 1d array of declination, length wl tGPS is array of linearly spaced time values within 630720013 and 1261872018 of length wl Eephem & Sephem contain ephemeris data for the Earth and Sun respectively dt = tGPS[1]-tGPS[0] """ #initialises training sets TS = np.zeros((tssize, wl)) for i in range(tssize): #performs barycentring functions for source i emit = get_bary_in_loop(tGPS, detector,[source[0][i], source[1][i]], Eephem, Sephem) #creates training vectors of time difference [emitdt, emitte, emitdd, emitR, emitER, emitE, emitS] = emit TS[i]= np.reshape(emitdt, wl) ## normalises training vectors TS[i] /= np.sqrt(np.abs(greedy.dot_product(dt, TS[i], TS[i]))) # tolerance for stopping algorithm tol = 1e-12 #forms normalised basis vectors RB = greedy.greedy(TS, dt, tol) return RB