Пример #1
0
def doit():
	qfitsins = g.execute("SELECT id FROM youpi_plugin_fitsin")
	print "Total: %d images have been successfully qualityFITSed (first quality evaluation)" % len(qfitsins)

	i = 1
	for entry in qfitsins:
		print "---> Image %03d / %03d follows:" % (i, len(qfitsins))
		w.ingestQFitsInResults(entry[0], g);
		g.con.commit()
		i += 1
Пример #2
0
def updateQFits(g):
	"""
	Updates all QFits information based on XML output of scamp.xml and psfex.xml

	@param g DBGeneric instance for DB connection
	"""
	global done
	done = 0
	if FORCE_ALL:
		q = """
SELECT f.id, t.results_output_dir, t.id FROM youpi_processing_task AS t, youpi_plugin_fitsin AS f
WHERE f.task_id=t.id
AND t.success=1
"""
	else:
		# Only QFits with no psffwhmmin, psffwhmmax and psffwhm values
		q = """
SELECT f.id, t.results_output_dir, t.id FROM youpi_processing_task AS t, youpi_plugin_fitsin AS f
WHERE f.task_id=t.id
AND t.success=1
AND f.psffwhmmin IS NULL
AND f.psffwhmmax IS NULL
AND f.psffwhm IS NULL
"""
	res = g.execute(q)
	total = len(res)
	if STATS_ONLY:
		print "QFits with no post-processing data:        %5d" % total
		return False

	print "Number of QFits to process: %d" % total
	for r in res:
		image_id = g.execute("SELECT image_id FROM youpi_rel_it WHERE task_id=%d" % r[2])[0][0]
		image = Image.objects.filter(id = image_id)[0]
		userData = {'RealImageName': image.filename}
		vout = " QFits %06d/%d [T: %d F:%d I:%s]" % (done+1, total, r[2], r[0], userData['RealImageName'])
		if VERBOSE:
			print '-' * 2 + vout + '-' * 30
		else:
			sys.stdout.write('.')
			sys.stdout.flush()
		if not SIMULATE:
			try:
				log =  wp.ingestQFitsInResults(r[1], userData, r[0], g)
			except Exception, e:
				print "\nError at%s\nException: %s" % (vout, e)
			g.con.commit()
		done += 1