Example #1
0
def buildObjectsFromJSON(filename):
	""" Reads a JSON file and re-constructs the object list... returns it as an array
	"""
	config = readConfigFile()
	debug = classes.debugObject(config.DEBUG)
	JSONfile = open(filename, "r")

	wholeFileString = JSONfile.read()

	allObjectsJSON = json.loads(wholeFileString)

	objects = []

	for i in allObjectsJSON:
		ob = json.loads(i)
		# Create a new instance of ObservedObject for this object 
		newObject = classes.ObservedObject(ob['id'])
		newObject.currentPosition = (ob['x'], ob['y'])
		debug.write("ID: %d (%d, %d)"%(ob['id'], int(ob['x']), int(ob['y'])))
		dataArray = ob['data']
		for data in dataArray:
			newObject.addExposure(data[2],data[3], data[1], 0, data[0], 0)
			debug.write(data)
		objects.append(newObject)
		
	return objects
	if arg.createconfig:
		ultracamutils.createConfigFile()
		sys.exit()
	
	config = ultracamutils.readConfigFile(arg.configfile)
	
	innerSkyRadius = float(config.INNER_SKY)
	outerSkyRadius = float(config.OUTER_SKY)
	apertureRadius = float(config.APERTURE_RADIUS)
	polynomialDegree = int(config.POLY_DEGREE)
	numReferenceApertures = int(config.REF_APERTURES)
	if arg.apertures!=None: numReferenceApertures = arg.apertures
	applyShift = True
	if (arg.noshift):
		applyShift = False
	debug = classes.debugObject(config.DEBUG)
	debug.toggleTimeLog()
	if (arg.debuglevel!=None): debug.setLevel(arg.debuglevel);
	debug.write(arg, level = 2)
	debug.write("Astropy version %s"%(astropy.__version__), level = 3)
	
	sourcesFilename = ultracamutils.addPaths(config.WORKINGDIR, arg.runname) + "_sources.csv"
	debug.write("Loading source list from: " + sourcesFilename, 2)	
	sourceList = ultraspecClasses.sourceList()
	success = sourceList.loadFromCSV(sourcesFilename)
	if (not success):
		debug.error("Unable to open the list of sources. Have you run uspecCreateSourceMap yet?")
		sys.exit()
	else:
		debug.write("Loaded %d sources from the CSV file."%sourceList.getNumSources(), 2)
	referenceApertures = ultraspecClasses.referenceApertures()
Example #3
0
	


if (__name__ == "__main__"):
	parser = argparse.ArgumentParser(description='Reads the files produced by earlier steps in the pipeline.')
	parser.add_argument('runname', type=str, help='Ultracam run name  [eg 2013-07-21/run010]')
	parser.add_argument('-c', '--configfile', default='ucambuilder.conf', help='The config file, usually ucambuilder.conf')
	parser.add_argument('--xyls', action='store_true', help='Create an XY-list for each channel. Used by Astrometry.net')
	parser.add_argument('-d', '--debuglevel', default = 1, type=int, help='Debug level: 3 - verbose, 2 - normal, 1 - warnings only')
	parser.add_argument('-s', '--saveasdiff', action='store_true', help='Compute differential photometry and save all photometry as fraction of comparison stars.')
	parser.add_argument('-v', '--version', default='primary', help="Optional version string.")
	
	arg = parser.parse_args()
	
	config = ultracamutils.readConfigFile(arg.configfile)
	debug = classes.debugObject(config.DEBUG)
	debug.toggleTimeLog()
	if (arg.debuglevel!=None): debug.setLevel(arg.debuglevel);
	debug.write(config)
	
	runName = arg.runname
	
	debug = classes.debugObject(arg.debuglevel)
	debug.write("Getting run info from the file:" + config.RUNINFO, level = 2)
	runDate, runID = ultracamutils.separateRunNameAndDate(arg.runname)

	runInfo = classes.runObject(runDate, runID)
	runInfo.version = arg.version
	runInfo.loadSelf(config)
	# runInfo = ultracamutils.getRunInfo(config.RUNINFO, arg.runname)
	
Example #4
0
    debug.write("Frame:" + str(frameCounter) + "  MJD:" + str(frameMJD), level=1)

    frameWindows = []
    for i in frameR._data:
        frameWindows.append(i.data)
    for i in frameG._data:
        frameWindows.append(i.data)
    for i in frameB._data:
        frameWindows.append(i.data)

    return frameWindows


config = utils.readConfigFile()
debug = classes.debugObject(1)
debug.toggleTimeLog()

if len(sys.argv) < 2:
    print "Please give me a run name."
    sys.exit()

runName = sys.argv[1]
runFilename = utils.addPaths(config.ULTRACAMRAW, runName)

startFrame = 1
requestedNumFrames = -1
CCDside = 0
keepTmpFiles = False
frameInfo = classes.FrameObject()
tmpMoviePath = config.MOVIE_TMP_PATH