rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
reimgs = [int(re.image_id) for re in rels] | reimgs = [int(rel.image_id) for rel in rels] | def __getCondorSubmissionFile(self, request, idList, headDataPath): """ Generates a suitable Condor submission for processing images on the cluster. |
flatNormMethod = post['FlatNormMethod'] | def __getCondorSubmissionFile(self, request, idList): """ Generates a suitable Condor submission for processing images on the cluster. | |
userData['Descr'] = str("%s of %s" % (self.optionLabel, img.name)) | userData['Descr'] = str("%s of image %s" % (self.optionLabel, img.name)) | def debug(msg): print "[YWP@%s] %s" % ("%02d:%02d:%02d" % time.localtime(time.time())[3:6], msg) sys.stdout.flush() |
'resultsOutputDir' : str(self.getUserResultsOutputDir(request)), | 'resultsOutputDir' : str(data['resultsOutputDir']), | def getSavedItems(self, request): """ Returns a user's saved items for this plugin """ items, filtered = read_proxy(request, CartItem.objects.filter(kind__name__exact = self.id).order_by('-date')) res = [] for it in items: data = marshal.loads(base64.decodestring(str(it.data))) res.append({ 'date' : "%s %s" % (it.d... |
query = tquery + query + ' AND task.success=1;' | if query.find('youpi_processing_task') > 0: query = tquery + query + ' AND task.success=1;' else: query = tquery + query | def get_global_report(request, reportId): """ Generates a global report. @param reportId report Id """ post = request.POST if reportId == 'imssavedselections': from terapix.reporting.csv import CSVReport sels = ImageSelections.objects.all().order_by('date') content = [] k = 1 for s in sels: content.append((k, s.name)) ... |
if type(iname) != types.StringType: | if type(iname) != types.StringType and type(iname) != types.UnicodeType: | def getPluginByName(self, iname): """ Returns plugin object by internal name if found or None. """ if type(iname) != types.StringType: raise TypeError, "iname must be a string" |
print '-' * 60 print '-- Processing plugin exception occured! Traceback follows' print '-' * 60 traceback.print_exc(file = sys.stdout) print '-' * 60 | if settings.DEBUG: print '-' * 60 print '-- Processing plugin exception occured! Traceback follows' print '-' * 60 traceback.print_exc(file = sys.stdout) print '-' * 60 | def processing_plugin(request): """ Entry point for client-side JS code to call any registered plugin's method """ try: pluginName = request.POST['Plugin'] method = request.POST['Method'] except Exception, e: raise PostDataError, e if method == 'getTaskInfo': if not request.user.has_perm('youpi.can_view_results'): re... |
tasksTags = [] q = """ SELECT t.id FROM youpi_processing_task AS t, youpi_rel_it AS r, youpi_rel_tagi AS ti, youpi_tag AS tag WHERE tag.name in (%s) AND tag.id = ti.tag_id AND ti.image_id = r.image_id AND r.task_id = t.id AND t.id IN (%s) """ % (','.join(["'%s'" % t for t in tags]), ','.join([str(t) for t in tasksIds])... | tasksTags = tasksIds for t in tags: q = """ SELECT t.id FROM youpi_processing_task AS t, youpi_rel_it AS r, youpi_rel_tagi AS ti, youpi_tag AS tag WHERE tag.name='%s' AND tag.id = ti.tag_id AND ti.image_id = r.image_id AND r.task_id = t.id AND t.id IN (%s) """ % (t, ','.join([str(t) for t in tasksTags])) cur.execute(q)... | def task_filter(request): try: # May be a list of owners owner = request.POST.getlist('Owner') status = request.POST['Status'] kindid = request.POST['Kind'] # Max results per page maxPerPage = int(request.POST['Limit']) # page # to return targetPage = int(request.POST['Page']) tags = request.POST.getlist('Tag') except ... |
(imgName, task_id, g) = task_start_log(userData, start, kind_id) | def process(userData, kind_id, argv): """ Execute system call then updates the database consequently. exit_code != 0 means problem. """ user_id = userData['UserID'] kind = userData['Kind'] # Log file to store storeLog = '_condor_stderr' success = 0 db = DB(host = DATABASE_HOST, user = DATABASE_USER, passwd = DATABASE... | |
g.con.commit() | def process(userData, kind_id, argv): """ Execute system call then updates the database consequently. exit_code != 0 means problem. """ user_id = userData['UserID'] kind = userData['Kind'] # Log file to store storeLog = '_condor_stderr' success = 0 db = DB(host = DATABASE_HOST, user = DATABASE_USER, passwd = DATABASE... | |
del db | def process(userData, kind_id, argv): """ Execute system call then updates the database consequently. exit_code != 0 means problem. """ user_id = userData['UserID'] kind = userData['Kind'] # Log file to store storeLog = '_condor_stderr' success = 0 db = DB(host = DATABASE_HOST, user = DATABASE_USER, passwd = DATABASE... | |
else: machine = settings.INGESTION_DEFAULT_HOST | def condor_ingestion(request): """ Callback for running a Condor ingestion. """ # HOST_DOMAIN try: path = request.POST['Path'] ingestionId = request.POST['IngestionId'] email = request.POST.get('ReportEmail', settings.CONDOR_NOTIFY_USER) checkAllowSeveralTimes = request.POST.get('CheckAllowSeveralTimes', 'no') checkSk... | |
(os.path.join('/media', settings.MEDIA_TMP, fname), format), | (os.path.join('/media', settings.MEDIA_TMP, fname + "?%s" % time.time()), format), | def getReport(self, request, reportId, format): """ Generates a report. @param reportId report Id as returned by the reports() function @param format report's output format """ post = request.POST ext = format.lower() fname = "%s-%s.%s" % (request.user.username, reportId, ext) title = get_report_data(self.reports(), re... |
debug("Could not ingest final stack image. Error: %s" % e) | debug("[Error] Could not ingest final stack image: %s" % e) | def process(userData, kind_id, argv): """ Execute system call then updates the database consequently. exit_code != 0 means problem. """ user_id = userData['UserID'] kind = userData['Kind'] # Log file to store storeLog = '_condor_stderr' success = 0 db = DB(host = DATABASE_HOST, user = DATABASE_USER, passwd = DATABASE... |
imgout = getConfigValue(configContent, 'IMAGEOUT_NAME') if imgout: tiff = os.path.join(userData['ResultsOutputDir'], 'swarp.tif') os.system("%s %s -OUTFILE_NAME %s -BINNING 40 2>/dev/null" % (CMD_STIFF, imgout, tiff)) os.system("%s %s %s" % (CMD_CONVERT, tiff, os.path.join(userData['ResultsOutputDir'], 'swarp.png'))) ... | if exit_code == 0: imgout = getConfigValue(configContent, 'IMAGEOUT_NAME') if imgout: debug("Converting FITS image into a PNG bitmap") tiff = os.path.join(userData['ResultsOutputDir'], 'swarp.tif') cmd1 = "%s %s -OUTFILE_NAME %s -BINNING 40 2>/dev/null" % (CMD_STIFF, os.path.join(userData['ResultsOutputDir'], imgout),... | def process(userData, kind_id, argv): """ Execute system call then updates the database consequently. exit_code != 0 means problem. """ user_id = userData['UserID'] kind = userData['Kind'] # Log file to store storeLog = '_condor_stderr' success = 0 db = DB(host = DATABASE_HOST, user = DATABASE_USER, passwd = DATABASE... |
if line.find('version') != -1: | if line.find('<?xml version="1.0"?>') != -1: | def getJobClusterId(userData): """ Gets current job Condor ID @returns cluster id string """ pipe = os.popen(os.path.join(CONDOR_BIN_PATH, 'condor_q -global -xml -l')) data = pipe.readlines() pipe.close() # Condor returns several XML files as output... Output should # then be filtered files = [] k = 0 idxs = [] for l... |
res.append((imgName, grades[0][0], grades[0][1], grades[0][2], grades[0][3], grades[0][4], grades[0][5], grades[0][6])) | res.append((imgName, grades[0][0], grades[0][2], grades[0][3], grades[0][4], grades[0][1], grades[0][5], grades[0][6])) | def get_grades(res_output_dir = None, idList = None): """ Returns all images grades in the database. Only the latest grade, when available, is returned for each image. Both user-defined and previous release grades are checked for grading information and comment. @return a list of tuples [(image name, grade, comment), ... |
res.append((imgName, latest[0], latest[1], latest[2], latest[3], latest[4], latest[5], grades[0][6])) | res.append((imgName, latest[0], latest[2], latest[3], latest[4], latest[1], latest[5], grades[0][6])) | def get_grades(res_output_dir = None, idList = None): """ Returns all images grades in the database. Only the latest grade, when available, is returned for each image. Both user-defined and previous release grades are checked for grading information and comment. @return a list of tuples [(image name, grade, comment), ... |
res.insert(0, header) | def get_grades(res_output_dir = None, idList = None): """ Returns all images grades in the database. Only the latest grade, when available, is returned for each image. Both user-defined and previous release grades are checked for grading information and comment. @return a list of tuples [(image name, grade, comment), ... | |
for unchecked in ps[1:]: | tmp = ps[1:][:] tmp.reverse() for unchecked in tmp: | def get_selected_ids_from_pagination(request): """ Returns a list of ids of selected images (in pagination mode) """ try: ids = request.POST['Ids'] pageStatus = request.POST['PageStatus'].split('_') except Exception, e: return HttpResponseBadRequest('Incorrect POST data') # Build integer list from ranges ids = unrema... |
os.system("%s -c %s -OUTFILE_NAME %s.tif %s" % (CMD_STIFF, '""" + customrc + """', imgName, tmpImage)) | os.system("%s -c %s -OUTFILE_NAME %s.tif %s 2>&1" % (CMD_STIFF, '""" + os.path.basename(customrc) + """', imgName, tmpImage)) | def debug(msg): print "[YWP@%s] %s" % ("%02d:%02d:%02d" % time.localtime(time.time())[3:6], msg) sys.stdout.flush() |
self.assertEquals(int(k.group(1)),types.IntType) self.assertEquals(int(k.group(2)),types.IntType) self.assertEquals(float(k.group(3)),types.FloatType) | def test_deg_to_sex(self): self.assertRaises(TypeError, cv.Alpha.deg_to_sex, 'x') self.assertRaises(TypeError, cv.Alpha.deg_to_sex, ['a','b']) self.assertRaises(ValueError, cv.Alpha.deg_to_sex, 400) self.assertRaises(ValueError, cv.Alpha.deg_to_sex, -2.) | |
self.assertEquals(g, types.FloatType) | self.assertEquals(type(g), types.FloatType) | def test_sex_to_deg(self): for k in (lambda x: x, 3, object()): self.assertRaises(TypeError, cv.Alpha.sex_to_deg, k) |
self.assertEquals(int(k.group(1)),types.IntType) self.assertEquals(int(k.group(2)),types.IntType) self.assertEquals(float(k.group(3)),types.FloatType) | def test_deg_to_sex(self): self.assertRaises(TypeError,cv.Delta.deg_to_sex, 'x') self.assertRaises(TypeError, cv.Delta.deg_to_sex, ['a','b']) self.assertRaises(ValueError, cv.Delta.deg_to_sex, 100) self.assertRaises(ValueError, cv.Delta.deg_to_sex, -91.) | |
paths[str(k)] | paths[str(k)].sort() | def getMiscDataPaths(self, request): """ Returns a JSON object with paths to flags and weights """ post = request.POST try: keys = post['Keys'].split(',') except Exception, e: raise PluginError, "POST argument error. Unable to process data." |
fmt = '%-' + str(g_title_width) + 's %-20s %-8s %-10s %3s' | fmt = '%-' + str(g_title_width) + 's %-20s %-8s %-12s %3s' | def print_processings(tasks): total = tasks.count() fmt = '%-' + str(g_title_width) + 's %-20s %-8s %-10s %3s' print ('%4s ' + fmt) % ('#', 'Title', 'Start', 'Duration', 'User', 'Success') print '-' * 90 k = 1 for t in tasks[:g_limit]: if t.success: state = 'yes' else: state = 'no' print ('%04d ' + fmt) % (k, t.title[:... |
print '-' * 90 | print '-' * (56+g_title_width) | def print_processings(tasks): total = tasks.count() fmt = '%-' + str(g_title_width) + 's %-20s %-8s %-10s %3s' print ('%4s ' + fmt) % ('#', 'Title', 'Start', 'Duration', 'User', 'Success') print '-' * 90 k = 1 for t in tasks[:g_limit]: if t.success: state = 'yes' else: state = 'no' print ('%04d ' + fmt) % (k, t.title[:... |
imgName = g.execute(""" SELECT i.name FROM youpi_rel_it AS r, youpi_image AS i, youpi_plugin_fitsin AS f | from common import get_pixel_scale imgName, imgPath, pixelscale, imgId = g.execute(""" SELECT i.name, i.path, i.pixelscale, i.id FROM youpi_rel_it AS r, youpi_image AS i, youpi_plugin_fitsin AS f | def ingestQFitsInResults(fitsinId, g): """ Stores results from QFits-in outputs. """ imgName = g.execute(""" |
""" % fitsinId)[0][0] | """ % fitsinId)[0] | def ingestQFitsInResults(fitsinId, g): """ Stores results from QFits-in outputs. """ imgName = g.execute(""" |
'psfex.xml' : { 'XML_elem' : 'PARAM', 'ATTR_name' : 'name', 'ATTR_values': (('FWHM_Min', 'psffwhmmin'), ('FWHM_Mean', 'psffwhm'), ('FWHM_Max', 'psffwhmmax'), ('Elongation_Min', 'psfelmin'), ('Elongation_Mean', 'psfel'), ('Elongation_Max', 'psfelmax'), ('Chi2_Min', 'psfchi2min'), ('Chi2_Mean', 'psfch... | def ingestQFitsInResults(fitsinId, g): """ Stores results from QFits-in outputs. """ imgName = g.execute(""" | |
imgs = Image.objects.filter(name__startswith = sp[0]) | imgs = Image.objects.filter(name__exact = sp[0]) | def ims_import_selections(request): """ Batch import selections of images. Import all selection files in a directory. File names are matched against a pattern. For each file the selection is matched. If ok creates a new saved selection. If at least one image is missing from a selection description, no saved selection i... |
imgs = Image.objects.filter(name__startswith = sp[0], checksum = sp[1]) | imgs = Image.objects.filter(name__exact = sp[0], checksum = sp[1]) | def ims_import_selections(request): """ Batch import selections of images. Import all selection files in a directory. File names are matched against a pattern. For each file the selection is matched. If ok creates a new saved selection. If at least one image is missing from a selection description, no saved selection i... |
if status == 'successful': success = 1 elif status == 'failed': success = 0 else: anyStatus = True from django.db import connection cur = connection.cursor() q = """ SELECT t.id FROM youpi_processing_task AS t, youpi_processing_kind AS k WHERE t.kind_id=k.id AND k.name = '%s' %s ORDER BY end_date DESC """ | success = failure = True if status == 'successful': failure = False elif status == 'failed': success = False owner = owner[0] if owner == 'my': owner = request.user.username elif owner == 'all': owner = None tasks = find_tasks(tags, task_id=None, kind=kindid, user=owner, success=success, failure=failure) tasksIds =... | def task_filter(request): try: # May be a list of owners owner = request.POST.getlist('Owner') status = request.POST['Status'] kindid = request.POST['Kind'] # Max results per page maxPerPage = int(request.POST['Limit']) # page # to return targetPage = int(request.POST['Page']) tags = request.POST.getlist('Tag') except ... |
user_id = request.user.id dupowner = [name for name in owner] if 'all' in dupowner: if anyStatus: cur.execute(q % (kindid, '')) else: cur.execute(q % (kindid, "AND t.success = %d" % success)) elif 'others' in dupowner: if anyStatus: cur.execute(q % (kindid, "AND t.user_id != %d" % user_id)) else: cur.execute(q % (ki... | def task_filter(request): try: # May be a list of owners owner = request.POST.getlist('Owner') status = request.POST['Status'] kindid = request.POST['Kind'] # Max results per page maxPerPage = int(request.POST['Limit']) # page # to return targetPage = int(request.POST['Page']) tags = request.POST.getlist('Tag') except ... | |
glob_perms.append([pperm.name, pperm.codename]) | glob_perms.append([pperm.name, 'youpi.' + pperm.codename]) | def preferences(request): """ Preferences template """ import ConfigParser config = ConfigParser.RawConfigParser() # Looks for themes theme_dirs = glob.glob(os.path.join(settings.MEDIA_ROOT, 'themes', '*')) themes = [] for dir in theme_dirs: try: config.read(os.path.join(dir, 'META')) except: # No META data, theme no... |
if type(params) != types.StringType: | if type(params) != types.StringType and type(params) != types.UnicodeType: | def get_requirement_string(params, vms): """ Returns Condor's requirement string for a *POLICY* For params, allowed criteria are among: MEM, DSK, HST, SLT @params string of params like 'MEM,G,1,G' @params list vms available cluster nodes """ if type(params) != types.StringType: raise TypeError, "params must be a strin... |
data = Plugin_fitsin.objects.filter(task__id = taskid)[0] | try: data = Plugin_fitsin.objects.filter(task__id = taskid)[0] except: return { 'TaskId' : str(taskid), 'Title' : str("%s - %s.fits" % (self.description, img.name)), 'User' : str(task.user.username), 'Hostname' : str(task.hostname), 'ClusterId' : str(task.clusterId), 'Success' : task.success, 'Start' ... | def getTaskInfo(self, request): """ Returns information about a finished processing task """ post = request.POST try: taskid = post['TaskId'] except Exception, e: raise PluginError, "POST argument error. Unable to process data." |
imgs = Image.objects.filter(name__startswith = sp[0]) | imgs = Image.objects.filter(name__exact = sp[0]) | def ims_get_image_list_from_file(request): """ Parse content of fileName and returns an image selection """ try: fileName = request.POST['Filename'] onTheFly = json.decode(request.POST['OnTheFly']) except Exception, e: return HttpResponseBadRequest('Incorrect POST data') errMsg = '' try: f = open('/tmp/' + request.use... |
imgs = Image.objects.filter(name__startswith = sp[0], checksum = sp[1]) | imgs = Image.objects.filter(name__exact = sp[0], checksum = sp[1]) | def ims_get_image_list_from_file(request): """ Parse content of fileName and returns an image selection """ try: fileName = request.POST['Filename'] onTheFly = json.decode(request.POST['OnTheFly']) except Exception, e: return HttpResponseBadRequest('Incorrect POST data') errMsg = '' try: f = open('/tmp/' + request.use... |
res = g.execute("""select name, checksum from youpi_image where name = "%s";""" % fitsNoExt); | res = g.execute("""select name, checksum from youpi_image where name = "%s" order by 2;""" % fitsNoExt); | def run_ingestion(): """ Ingestion procedure of FITS images in the database """ global log, email, script_args, ingestionId, g, ittdata email = script_args['email'] user_id = script_args['user_id'] path = script_args['path'] ingestion_id = script_args['ingestion_id'] # parsing otherArgs duration_stime = time.time()... |
dbchecksum = res[0][1] if checksum == dbchecksum: | matched = False for r in res: dbchecksum = r[1] if checksum == dbchecksum: matched = True if matched: | def run_ingestion(): """ Ingestion procedure of FITS images in the database """ global log, email, script_args, ingestionId, g, ittdata email = script_args['email'] user_id = script_args['user_id'] path = script_args['path'] ingestion_id = script_args['ingestion_id'] # parsing otherArgs duration_stime = time.time()... |
debug("\tImage %s with same name and checksum: multiple option state to ON, Ingestion..." % fitsfile) | debug("\tImage %s with same name and checksum: multiple option is ON, ingesting..." % fitsfile) | def run_ingestion(): """ Ingestion procedure of FITS images in the database """ global log, email, script_args, ingestionId, g, ittdata email = script_args['email'] user_id = script_args['user_id'] path = script_args['path'] ingestion_id = script_args['ingestion_id'] # parsing otherArgs duration_stime = time.time()... |
debug("\tImage %s with same name and checksum: multiple option state to OFF, Skipping..." % fitsfile) | debug("\tImage %s with same name and checksum: multiple option state is OFF, skipping..." % fitsfile) | def run_ingestion(): """ Ingestion procedure of FITS images in the database """ global log, email, script_args, ingestionId, g, ittdata email = script_args['email'] user_id = script_args['user_id'] path = script_args['path'] ingestion_id = script_args['ingestion_id'] # parsing otherArgs duration_stime = time.time()... |
debug("Image %s already exists in database (same odometer number for different checksum). Skipping..." % fitsfile, WARNING) continue | debug("Image %s already exists in the database (same name but different checksum). ingesting..." % fitsfile) | def run_ingestion(): """ Ingestion procedure of FITS images in the database """ global log, email, script_args, ingestionId, g, ittdata email = script_args['email'] user_id = script_args['user_id'] path = script_args['path'] ingestion_id = script_args['ingestion_id'] # parsing otherArgs duration_stime = time.time()... |
sys.exit(1) | raise | def getFITSheader(fitsObj, fitsfile): """ Returns a valid FITS header if found. """ try: h1 = fitsObj[1].header except IndexError, e: try: h1 = fitsObj[0].header except: # # Trick needed to get FITS info because r.info() prints to stdout # directly # old = sys.stdout buf = StringBuffer() sys.stdout = buf fitsObj.info()... |
res = g.execute("""select label from youpi_ingestion where label = "%s";""" % ing_label) if res: ing_label += '_1' | res = g.execute("""select label from youpi_ingestion where label like "%s" order by end_ingestion_date desc;""" % (ing_label + '%')) if res: ing_label = res[0][0] + '_1' | def run_stack_ingestion(g, stackFile, user_id): """ Ingestion of Stack image @param g DBGeneric instance @param stackFile full path to file @param user_id current user DB id """ global log duration_stime = time.time() ipath = os.path.dirname(stackFile) fitsNoExt = os.path.basename(stackFile.replace(FITSEXT, NULLSTRING... |
debug("Matching instrument '%s' not found in DB. Image ingestion skipped." % detector, WARNING) sys.exit(1) | msg = "Matching instrument '%s' not found in DB. Image ingestion skipped." % detector raise ValueError, msg | def run_stack_ingestion(g, stackFile, user_id): """ Ingestion of Stack image @param g DBGeneric instance @param stackFile full path to file @param user_id current user DB id """ global log duration_stime = time.time() ipath = os.path.dirname(stackFile) fitsNoExt = os.path.basename(stackFile.replace(FITSEXT, NULLSTRING... |
if res_output_dir and type(res_output_dir) != types.StringType: | if res_output_dir and type(res_output_dir) != types.StringType and type(res_output_dir) != types.UnicodeType: | def get_grades(res_output_dir = None, idList = None): """ Returns all images grades in the database. Only the latest grade, when available, is returned for each image. Both user-defined and previous release grades are checked for grading information and comment. @return a list of tuples [(image name, grade, comment), ... |
fixtures = ['test_user', 'test_tags'] | fixtures = ['test_user', 'test_ingestion', 'test_instrument', 'test_channel', 'test_image', 'test_tag'] | def test_toOctal(self): o = self.perm.toOctal() self.assertTrue(type(o) == types.StringType) self.assertTrue(len(o) == 3) self.assertTrue(re.match(r'^\d{3}$', o)) bits = [int(b) for b in re.findall(r'\d', o)] for m in bits: self.assertTrue(m in auth.bits_range) |
print response.content | def test_tag_unmark_images(self): self.client.login(username='user1', password='youpi') response = self.client.post(reverse('terapix.youpi.cviews.tags.tag_unmark_images'),{ 'Tags': '[\'tag1\']', 'IdList': '[\'1\',\'2\']' }) print response.content self.assertEquals(type(response.content), types.StringType) | |
if userData['RealImageName'][0] != str(img.name): image_args += " -o %s" % str(img.name) + '/qualityFITS' | if userData['RealImageName'] != str(img.name): image_args += " -o %s" % os.path.join(img.name, 'qualityFITS') | def __getCondorSubmissionFile(self, request, idList): """ Generates a suitable Condor submission for processing images on the cluster. |
task = Processing_task.objects.filter(id = taskid)[0] | task, filtered = read_proxy(request, Processing_task.objects.filter(id = taskid)) if not task: return {'Error': str("Sorry, you don't have permission to see this result entry.")} | def getTaskInfo(self, request): """ Returns information about a finished processing task """ post = request.POST try: taskid = post['TaskId'] except Exception, e: raise PluginError, "POST argument error. Unable to process data." |
error = condorError = '' | error = condorError = info = '' | def process(self, request): """ Do the job. 1. Generates a condor submission file 2. Executes condor_submit on that file 3. Returns info related to ClusterId and number of jobs submitted """ try: idList = eval(request.POST['IdList']) # List of lists except Exception, e: raise PluginError, "POST argument error. Unable t... |
return {'ClusterIds': cluster_ids, 'Error': error, 'CondorError': condorError} | return {'ClusterIds': cluster_ids, 'NoData': info, 'Error': error, 'CondorError': condorError} | def process(self, request): """ Do the job. 1. Generates a condor submission file 2. Executes condor_submit on that file 3. Returns info related to ClusterId and number of jobs submitted """ try: idList = eval(request.POST['IdList']) # List of lists except Exception, e: raise PluginError, "POST argument error. Unable t... |
usergrades = FirstQEval.objects.all().values('fitsin').distinct() | fitsins = Plugin_fitsin.objects.filter(task__results_output_dir = outdir, task__success = True).values('id') fitsinsIds = [g['id'] for g in fitsins] usergrades = FirstQEval.objects.filter(fitsin__in = fitsins).values('fitsin').distinct() | def getReport(self, request, reportId): """ Generates a report. @param reportId report Id as returned by the reports() function """ post = request.POST |
fitsins = Plugin_fitsin.objects.filter(task__success = True).values('id') fitsinsIds = [g['id'] for g in fitsins] nongraded = [] | def getReport(self, request, reportId): """ Generates a report. @param reportId report Id as returned by the reports() function """ post = request.POST | |
trs = [] fitsins = Plugin_fitsin.objects.filter(id__in = fitsinsIds)[:50] | def getReport(self, request, reportId): """ Generates a report. @param reportId report Id as returned by the reports() function """ post = request.POST | |
tasks = Processing_task.objects.filter(id__in = tasksIds).order_by('-start_date') trs = [] | def getReport(self, request, reportId): """ Generates a report. @param reportId report Id as returned by the reports() function """ post = request.POST | |
tasks = Processing_task.objects.filter(id__in = tasksIds, results_output_dir = outdir).order_by('-start_date') | def getReport(self, request, reportId): """ Generates a report. @param reportId report Id as returned by the reports() function """ post = request.POST | |
tf.write(weight_files.replace(', ', '\n')) | def __getCondorSubmissionFile(self, request, idList, headDataPath): """ Generates a suitable Condor submission for processing images on the cluster. | |
pcontent = """ import os, glob, sys, time def debug(msg): print "[YWP@%s] %s" % ("%02d:%02d:%02d" % time.localtime(time.time())[3:6], msg) sys.stdout.flush() fzs = glob.glob('*.fits.fz') for fz in fzs: msg = "Swarp Preprocessing: uncompressing %s - " % fz exit_code = os.system(" """[:-1] + settings.CMD_IMCOPY + "... | tmplf = open('youpi/plugins/swarp-preprocessing.tmpl') tmpl = string.Template(''.join(tmplf.readlines())) tmplf.close() pf.write(tmpl.substitute({ 'swarp' : settings.CMD_SWARP, 'params' : swarp_params, 'imgsfile' : os.path.basename(swarpImgsFile), 'config' : os.path.basename(customrc), 'weight_files' : weight_file... | def __getCondorSubmissionFile(self, request, idList, headDataPath): """ Generates a suitable Condor submission for processing images on the cluster. |
'_weight.fits.fz'))]) | '_weight.fits'))]) | def getWeightPathsFromImageSelection(self, request, imgList = None): """ Compute data path of weight images for a given image selection @return List of paths to WEIGHT files """ |
im = Image.open(imageload) xsize, ysize = im.size new_height = float(ysize)/float(xsize)*new_width | def main(argv): unit = scribus.getUnit() units = [' pts','mm',' inches',' picas','cm',' ciceros'] unitlabel = units[unit] if scribus.selectionCount() == 0: scribus.messageBox('Scribus - Script Error', "There is no object selected.\nPlease select a text frame and try again.", scribus.ICON_WARNING, scribus.BUTTON_OK) sys... | |
startIndex = text.indexOf(self.multiLineStringBegin) | startIndex = self.multiLineStringBegin.indexIn(text) | def highlightBlock(self, text): self.setCurrentBlockState(0) if text.trimmed().isEmpty(): self.setFormat(0, len(text), self.empty_format) return self.setFormat(0, len(text), self.base_format) startIndex = 0 if self.previousBlockState() != 1: startIndex = text.indexOf(self.multiLineStringBegin) if startIndex > -1: ... |
endIndex = text.indexOf(self.multiLineStringEnd, | endIndex = self.multiLineStringEnd.indexIn(text, | def highlightBlock(self, text): self.setCurrentBlockState(0) if text.trimmed().isEmpty(): self.setFormat(0, len(text), self.empty_format) return self.setFormat(0, len(text), self.base_format) startIndex = 0 if self.previousBlockState() != 1: startIndex = text.indexOf(self.multiLineStringBegin) if startIndex > -1: ... |
startIndex = text.indexOf(self.multiLineStringBegin, | startIndex = self.multiLineStringBegin.indexIn(text, | def highlightBlock(self, text): self.setCurrentBlockState(0) if text.trimmed().isEmpty(): self.setFormat(0, len(text), self.empty_format) return self.setFormat(0, len(text), self.base_format) startIndex = 0 if self.previousBlockState() != 1: startIndex = text.indexOf(self.multiLineStringBegin) if startIndex > -1: ... |
index = text.indexOf(expression, start) | index = expression.indexIn(text, start) | def highlightRules(self, text, start, finish): for expression, format in self.rules: index = text.indexOf(expression, start) while index >= start and index < finish: length = expression.matchedLength() self.setFormat(index, min(length, finish - index), format) index = text.indexOf(expression, index + length) |
index = text.indexOf(expression, index + length) | index = expression.indexIn(text, index + length) | def highlightRules(self, text, start, finish): for expression, format in self.rules: index = text.indexOf(expression, start) while index >= start and index < finish: length = expression.matchedLength() self.setFormat(index, min(length, finish - index), format) index = text.indexOf(expression, index + length) |
if (self.model==MOTU_MODEL_TRAVELER or self.model==MOTU_MODEL_ULTRALITE or self.model=MOTU_MODEL_896HD): | if (self.model==MOTU_MODEL_TRAVELER or self.model==MOTU_MODEL_ULTRALITE or self.model==MOTU_MODEL_896HD): | def initValues(self): # Is the device streaming? self.is_streaming = self.hw.getDiscrete('/Mixer/Info/IsStreaming') log.debug("device streaming flag: %d" % (self.is_streaming)) |
class MonitoringDelegate(QtGui.QStyledItemDelegate): | class MonitoringDelegate(QtGui.QItemDelegate): | def flags(self, index): ret = QtCore.QAbstractTableModel.flags(self, index) if index.row() in (0,1,2): ret |= Qt.Qt.ItemIsEditable return ret |
QtGui.QStyledItemDelegate.__init__(self, parent) | QtGui.QItemDelegate.__init__(self, parent) | def __init__(self, parent): QtGui.QStyledItemDelegate.__init__(self, parent) |
return QtGui.QStyledItemDelegate.createEditor(self, parent, option, index) | return QtGui.QItemDelegate.createEditor(self, parent, option, index) | def createEditor(self, parent, option, index): if index.data(Qt.Qt.EditRole).type() == QtCore.QVariant.StringList: combo = QtGui.QComboBox(parent) self.connect(combo, QtCore.SIGNAL("activated(int)"), self.currentChanged) return combo else: return QtGui.QStyledItemDelegate.createEditor(self, parent, option, index) |
QtGui.QStyledItemDelegate.setEditorData(self, editor, index) | QtGui.QItemDelegate.setEditorData(self, editor, index) | def setEditorData(self, editor, index): if isinstance(editor, QtGui.QComboBox): list = index.data(Qt.Qt.EditRole).toStringList() editor.addItems(list) editor.setCurrentIndex(list.indexOf(index.data(Qt.Qt.DisplayRole).toString())) else: QtGui.QStyledItemDelegate.setEditorData(self, editor, index) |
QtGui.QStyledItemDelegate.setModelData(self, editor, model, index) | QtGui.QItemDelegate.setModelData(self, editor, model, index) | def setModelData(self, editor, model, index): if isinstance(editor, QtGui.QComboBox): model.setData(index, editor.currentText(), Qt.Qt.EditRole) else: QtGui.QStyledItemDelegate.setModelData(self, editor, model, index) |
strip.lblName.setText("IN %d/%d" % (input_id+1, input_id+2)) | strip.lblName.setText("In %d/%d" % (input_id+1, input_id+2)) | def buildMixer(self): log.debug("Building mixer") self.MatrixButtonControls={} self.MatrixRotaryControls={} self.MatrixVolumeControls={} self.VolumeControls={} self.SelectorControls={} self.SPDIFmodeControls={} self.TriggerControls={} |
outputtabs.addTab( tab, "OUT %d/%d" % (output_id+1, output_id+2)) | outputtabs.addTab( tab, "Out %d/%d" % (output_id+1, output_id+2)) | def buildMixer(self): log.debug("Building mixer") self.MatrixButtonControls={} self.MatrixRotaryControls={} self.MatrixVolumeControls={} self.VolumeControls={} self.SelectorControls={} self.SPDIFmodeControls={} self.TriggerControls={} |
grpInput.setTitle("IN %d" % (inpair+1)) | grpInput.setTitle("In %d" % (inpair+1)) | def buildMixer(self): log.debug("Building mixer") self.MatrixButtonControls={} self.MatrixRotaryControls={} self.MatrixVolumeControls={} self.VolumeControls={} self.SelectorControls={} self.SPDIFmodeControls={} self.TriggerControls={} |
outputtabs.addTab( tab, "INPUT") | outputtabs.addTab( tab, "Input") | def buildMixer(self): log.debug("Building mixer") self.MatrixButtonControls={} self.MatrixRotaryControls={} self.MatrixVolumeControls={} self.VolumeControls={} self.SelectorControls={} self.SPDIFmodeControls={} self.TriggerControls={} |
outputtabs.addTab( tab, "SETTINGS") | outputtabs.addTab( tab, "Settings") | def buildMixer(self): log.debug("Building mixer") self.MatrixButtonControls={} self.MatrixRotaryControls={} self.MatrixVolumeControls={} self.VolumeControls={} self.SelectorControls={} self.SPDIFmodeControls={} self.TriggerControls={} |
r.setHeight(r.height() * value) | r.setHeight(r.height() * math.sqrt(value)) | def paintEvent(self, event): p = QtGui.QPainter(self) value = self.level/4096 r = self.rect() r.setHeight(r.height() * value) r.moveBottom(self.rect().height()) p.fillRect(r, self.palette().highlight()) |
self.vu.updateLevel(value) | def peakValue(self, value): #self.vu.updateLevel(value) pass | |
self.vubtn = QtGui.QPushButton("Switch VU", self) | self.vubtn = QtGui.QPushButton("Switch peak meters", self) | def __init__(self, servername, basepath, parent=None): QtGui.QWidget.__init__(self, parent); self.bus = dbus.SessionBus() self.dev = self.bus.get_object(servername, basepath) self.interface = dbus.Interface(self.dev, dbus_interface="org.ffado.Control.Element.CrossbarRouter") |
log.debug("Got %i peaks" % len(peakvalues)) | def updateLevels(self): #log.debug("CrossbarRouter.updateLevels()") peakvalues = self.interface.getPeakValues() log.debug("Got %i peaks" % len(peakvalues)) for peak in peakvalues: #log.debug("peak = [%s,%s]" % (str(peak[0]),str(peak[1]))) if peak[0] >= 0: self.switchers[peak[0]].peakValue(peak[1]) | |
def dbusxx_xml2cpp_emitter(target, source, env): env.Depends(target, " return (target, source) | def dbusxx_xml2cpp_emitter(target, source, env): env.Depends(target, "#/external/dbus/dbusxx-xml2cpp" ) return (target, source) | |
env.Execute( "./external/dbus/dbusxx-xml2cpp %s --adaptor=%s" % ( source[0], target[0] ) ) | env.Execute( "dbusxx-xml2cpp %s --adaptor=%s" % ( source[0], target[0] ) ) | def dbusxx_xml2cpp_adaptor_action( target, source, env ): env.Execute( "./external/dbus/dbusxx-xml2cpp %s --adaptor=%s" % ( source[0], target[0] ) ) return 0 |
env.Execute( "./external/dbus/dbusxx-xml2cpp %s --proxy=%s" % ( source[0], target[0] ) ) | env.Execute( "dbusxx-xml2cpp %s --proxy=%s" % ( source[0], target[0] ) ) | def dbusxx_xml2cpp_proxy_action( target, source, env ): env.Execute( "./external/dbus/dbusxx-xml2cpp %s --proxy=%s" % ( source[0], target[0] ) ) return 0 |
emitter = dbusxx_xml2cpp_emitter, | def generate( env, **kw ): env['BUILDERS']['Xml2Cpp_Adaptor'] = env.Builder(action = dbusxx_xml2cpp_adaptor_action, emitter = dbusxx_xml2cpp_emitter, suffix = '.h', src_suffix = '.xml') env['BUILDERS']['Xml2Cpp_Proxy'] = env.Builder(action = dbusxx_xml2cpp_proxy_action, emitter = dbusxx_xml2cpp_emitter, suffix = '.h', ... | |
if (self.model==MOTU_MODEL_828mk3 or self.mode==MOTU_MODEL_ULTRALITEmk3 or self.mode==MOTU_MODEL_ULTRALITEmk3_HYB): | if (self.model==MOTU_MODEL_828mk3 or self.model==MOTU_MODEL_ULTRALITEmk3 or self.model==MOTU_MODEL_ULTRALITEmk3_HYB): | def initValues(self): # Is the device streaming? self.is_streaming = self.hw.getDiscrete('/Mixer/Info/IsStreaming') log.debug("device streaming flag: %d" % (self.is_streaming)) |
version = "0.7.1", | version = "0.7.2", | def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() |
packages = find_packages('.'), package_dir = {'':'.'}, | packages = find_packages() | def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() |
package_data={ 'cmsplugin_pygments': [ 'templates/cmsplugin_pygments/*.html', ] }, | def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() | |
degrees = [b.element().degree() for v in arguments] | degrees = [v.element().degree() for v in arguments] | def estimate_quadrature_degree(integral): "Estimate the necessary quadrature order for integral using the sum of basis function degrees." arguments = extract_arguments(integral) degrees = [b.element().degree() for v in arguments] if len(arguments) == 0: return None if len(arguments) == 1: return 2*degrees[0] return sum... |
error("All components of a list tensor most provide same arguments") | error("All components of a list tensor must provide same arguments") | def list_tensor(self, x, *ops): |
return (part, provides) | return (x, provides) | def linear_operator(self, x, arg): """A linear operator in a single argument accepting arity > 0, providing whatever basis functions its argument does.""" |
return as_vector(a.dx(0), -a.dx(0)) | return as_vector((a.dx(1), -a.dx(0))) | def c(i, j): return a[j].dx(i) - a[i].dx(j) |
print self.element_map | def __init__(self, form, name="a", object_names={}): "Create form data for given form" | |
return as_matrix(([[-1/3*A[1,1]-1/3*A[2,2]+2/3*A[0,0],A[0,1],A[0,2]],[A[1,0],2/3*A[1,1]-1/3*A[2,2]-1/3*A[0,0],A[1,2]],[A[2,0],A[2,1],-1/3*A[1,1]+2/3*A[2,2]-1/3*A[0,0]]]) | return as_matrix([[-1/3*A[1,1]-1/3*A[2,2]+2/3*A[0,0],A[0,1],A[0,2]],[A[1,0],2/3*A[1,1]-1/3*A[2,2]-1/3*A[0,0],A[1,2]],[A[2,0],A[2,1],-1/3*A[1,1]+2/3*A[2,2]-1/3*A[0,0]]]) | def deviatoric(self, o, A): sh = self._square_matrix_shape(A) if sh[0] == 2: return as_matrix([[-1/2*A[1,1]+1/2*A[0,0],A[0,1]],[A[1,0],1/2*A[1,1]-1/2*A[0,0]]]) elif sh[0] == 3: return as_matrix(([[-1/3*A[1,1]-1/3*A[2,2]+2/3*A[0,0],A[0,1],A[0,2]],[A[1,0],2/3*A[1,1]-1/3*A[2,2]-1/3*A[0,0],A[1,2]],[A[2,0],A[2,1],-1/3*A[1,1... |
if isdir(local_data_dir): | if isdir(join(local_data_dir, 'dreampie')): | def find_data_dir(): """ Find the 'share' directory in which to find files. If we are inside the source directory, build subp zips. """ # Scenarios: # * Running from the source directory. 'share' is near 'dreampielib' # * Running from a unix installed executable. The scheme is: # prefix/bin/executable # prefix/shar... |
if isdir(py2exe_data_dir): | if isdir(join(py2exe_data_dir, 'dreampie')): | def find_data_dir(): """ Find the 'share' directory in which to find files. If we are inside the source directory, build subp zips. """ # Scenarios: # * Running from the source directory. 'share' is near 'dreampielib' # * Running from a unix installed executable. The scheme is: # prefix/bin/executable # prefix/shar... |
if isdir(unix_data_dir): | if isdir(join(unix_data_dir, 'dreampie')): | def find_data_dir(): """ Find the 'share' directory in which to find files. If we are inside the source directory, build subp zips. """ # Scenarios: # * Running from the source directory. 'share' is near 'dreampielib' # * Running from a unix installed executable. The scheme is: # prefix/bin/executable # prefix/shar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.