示例#1
0
def getInitTrips(triplets, savename):
    trackID = 1
    trackDict = {}
    print('assigning trackids')
    trips = []
    for trip in triplets:
        trips.append(trip)
        trip.trackid = trackID
        trackDict[trackID] = trip.dets
        trackID += 1
    # This loop makes a trackDict with trip.dets indexed starting at 1
    triplets = trips
    finalList = []
    goodIDs, badIDs = siftChecks(trackDict, savename)
    for i, chi in goodIDs:
        trip = Triplet(trackDict[i])
        trip.chiSq = chi
        trip.trackid = i
        finalList.append(trip)
    for i, chi in badIDs:
        trip = Triplet(trackDict[i])
        trip.trackid = i
        trip.chiSq = chi
        print('bad triplet:')
        print(trip)
        finalList.append(trip)
    return finalList
示例#2
0
def siftTrips(fitsName, trackDict, chiThresh=50):
    print('only keeping orbtis with chisq under ' + str(chiThresh))
    orbits = Table.read(fitsName, format='fits')

    # Records the initial time.
    time1 = time.time()
    mask_chisq = (orbits['CHISQ'] < chiThresh) & (orbits['FLAGS'] == 0)
    orbitIDs = orbits[mask_chisq]['ORBITID']
    # orbitIDs is the list of orbits with ChiSq under 50.
    tripList = []
    for row in orbitIDs:
        trackid = row
        objids = trackDict[trackid]
        # trackDict is a dictionary of orbits; trackDict[trackid] is a single orbit.
        del trackDict[trackid]
        trip = Triplet(objids)
        # Finds the triplet for the orbit.
        trip.trackid = trackid
        # Creates an ID for each triplet (called trackid).
        tripList.append(trip)
        # Creates tripList, a list of all triplets.

    # Records the final time.
    time2 = time.time()
    '''
    #version 2
    tripList2 = []
    for row in orbits:
        if row['CHISQ'] < chiThresh:
            trackid = '{0:06d}'.format(row['ORBITID'])
            objids = trackDict[trackid]
            tripList2.append(Triplet(objids))
    time3 = time.time()
    '''
    print('done after ' + str(time2 - time1) + ' seconds')

    #print('v2: ' + str(time3-time2))

    return tripList