Exemplo n.º 1
0
def updateMasterCatalog(newObjects, offSet):
	offSetX , offSetY = offSet
	recognisedCount = 0
	for o in newObjects:
		testX, testY = o['absX'] + offSetX, o['absY'] + offSetY
		
		# First test if this object is close to another....
		objectRecognised = False

		for eo in masterObjectList:
			if (eo.isDistanceMatch(o)!=-1):
				eo.addExposureByObject(o, wholeFrame['MJD'])
				objectRecognised = True
				recognisedCount+= 1
				break
		if (not objectRecognised):
			# Add this to the new object list
			newID = ultracamutils.getUniqueID(masterObjectList)
			newObject = classes.ObservedObject(newID)
			newObject.addExposureByObject(o, wholeFrame['MJD'])
			masterObjectList.append(newObject)
	totalObjects = len(masterObjectList)
	debug.write("%d objects being tracked. %d%% matches in this frame."%(totalObjects, (float(recognisedCount)/float(totalObjects))*100.0))
Exemplo n.º 2
0
			o.calculateMeanPosition()
			
	""" Sort the objects
	"""
	for c in channels:
		objects = allObjects[c]
		sortedObjects = sorted(objects, key= lambda p:p.meanFlux, reverse=True)
		allObjects[c] = sortedObjects
			
	
			
	colour = 'r'
	objects = allObjects[colour]
	masterObjectList = []
	for o in objects:
		newIDNumber = ultracamutils.getUniqueID(masterObjectList)
		colourObject = ucamObjectClass.colourObject(newIDNumber)
		debug.write("Created a new colourObject with id: %d"%(newIDNumber))
		
		colourObject.setMeanPosition(colour, o.meanPosition)
		colourObject.colourID[colour] = o.id
		
		""" Now move the photometry into the new object
		"""
		addPhotometry(colourObject, colour, o.exposures)
		masterObjectList.append(colourObject)

	distanceThreshold = float(config.MINPIXELDISTANCE)
	print "Threshold", distanceThreshold

	colour = 'g'
Exemplo n.º 3
0
 def addSource(self, source):
     if source.id == 0:
         # Generate a unique id for this new source
         newID = ultracamutils.getUniqueID(self.sources)
         source.id = newID
     self.sources.append(source)
Exemplo n.º 4
0
			if length<startCatalogLength:
				startCatalogIndex = c
				startCatalogLength = length
		debug.write("Channel with the smallest number of objects is %s with %d objects."%(channelDescriptions[startCatalogIndex], startCatalogLength))
				
		colourObjects = []
		
		threeColours = ['r', 'g', 'b']
		currentColour = startCatalogIndex
		debug.write("Running through the %s objects."%channelDescriptions[currentColour])
		threeColours.pop(threeColours.index(currentColour))
		print "Remaining colours", threeColours
		firstColourObjects = allObjectsCopy[startCatalogIndex]
		firstColourList = copy.copy(firstColourObjects)
		for o in firstColourObjects:
			id = ultracamutils.getUniqueID(colourObjects)
			colourObject = classes.combined3ColourObject(id)
			colourObject.setColourID(currentColour, o.id)
			firstColourList.remove(o)
			allObjectsCopy[currentColour] = firstColourList
			originalCoords = (o.ra, o.dec)
			for othercolour in threeColours:
				objects = allObjectsCopy[othercolour]
				debug.write("Looking for %s objects to match the current %s object"%(channelDescriptions[othercolour], channelDescriptions[currentColour]))
				closestDistance = 1
				closestObject = None
				for p in objects:
					objectCoords = (p.ra, p.dec)
					distance = ultracamutils.calculateDistance(originalCoords, objectCoords)
					if distance < closestDistance:
						closestDistance = distance