parser = OptionParser() parser.add_option("-c","--config", dest="inputfile", default="", help="Input parameter file [default: %default]") (options, args) = parser.parse_args() if(options.inputfile==''): inputPars = parset.ParameterSet() elif(not os.path.exists(options.inputfile)): logging.warning("Config file %s does not exist! Using default parameter values."%options.inputfile) inputPars = parset.ParameterSet() else: inputPars = parset.ParameterSet(options.inputfile).Eval sourceCatFile = inputPars.get_value('sourceCatalogue','') if(sourceCatFile == ''): logging.error('Eval.sourceCatalogue not provided. Doing no evaluation.') exit(0) if(not os.access(sourceCatFile,os.F_OK)): logging.error("Eval.sourceCatalogue %s does not exist. Doing no evaluation."%sourceCatFile) exit(0) sourceCatType = inputPars.get_value('sourceCatalogueType','Selavy') sourceCat = readCat(sourceCatFile,sourceCatType) sourceFluxScale = inputPars.get_value('sourceFluxScale',1.0) refCatFile = inputPars.get_value('refCatalogue','') if(refCatFile == ''): logging.error('Eval.refCatalogue not provided. Doing no evaluation.') exit(0) if(not os.access(refCatFile,os.F_OK)): logging.error("Eval.refCatalogue %s does not exist. Doing no evaluation."%refCatFile) exit(0)
if (options.inputfile == ''): inputPars = parset.ParameterSet() elif (not os.path.exists(options.inputfile)): logging.warning( "Config file %s does not exist! Using default parameter values." % options.inputfile) inputPars = parset.ParameterSet() else: inputPars = parset.ParameterSet(options.inputfile).Eval print inputPars sourceCatFile = inputPars.get_value('sourceCatalogue', '') if (sourceCatFile == ''): logging.error( 'Eval.sourceCatalogue not provided. Doing no evaluation.') exit(0) if (not os.access(sourceCatFile, os.F_OK)): logging.error( "Eval.sourceCatalogue %s does not exist. Doing no evaluation." % sourceCatFile) exit(0) sourceCatType = inputPars.get_value('sourceCatalogueType', 'Selavy') sourceCat = readCat(sourceCatFile, sourceCatType) print sourceCatFile refCatFile = inputPars.get_value('refCatalogue', '') if (refCatFile == ''): logging.error('Eval.refCatalogue not provided. Doing no evaluation.') exit(0) if (not os.access(refCatFile, os.F_OK)):
figsizes = inputPars.get_value('imageSizes', [16]) figsizenames = inputPars.get_value('imageSizeNames', ['large']) showWeightsContours = inputPars.get_value('showWeightsContours', False) robust = inputPars.get_value('robust', True) weightCutoff = inputPars.get_value('weightscutoff', 0.) # Error checking if len(figsizes) != len(figsizenames): raise IOError("figsizes and figsizenames must be the same length") if fitsim == '': raise IOError("No image defined") if not os.access(fitsim, os.F_OK): logging.error('Requested image %s not found' % fitsim) # Define the weights image - we use this for plotting contours and # determining the correct noise level. if weightsim != "" and not os.access(weightsim, os.F_OK): logging.warn( 'Weights image %s not found - no weights contours applied' % weightsim) # Get statistics for the image to determine greyscale levels. # If there is a matching weights image, use that to # avoid pixels that have zero weight. image = fits.getdata(fitsim) isgood = (np.ones(image.shape) > 0) if weightsim != "" and os.access(weightsim, os.F_OK): weights = fits.getdata(weightsim)
(options, args) = parser.parse_args() if(options.inputfile==''): inputPars = parset.ParameterSet() elif(not os.path.exists(options.inputfile)): logging.warning("Config file %s does not exist! Using default parameter values."%options.inputfile) inputPars = parset.ParameterSet() else: inputPars = parset.ParameterSet(options.inputfile).Eval print inputPars sourceCatFile = inputPars.get_value('sourceCatalogue','') if(sourceCatFile == ''): logging.error('Eval.sourceCatalogue not provided. Doing no evaluation.') exit(0) if(not os.access(sourceCatFile,os.F_OK)): logging.error("Eval.sourceCatalogue %s does not exist. Doing no evaluation."%sourceCatFile) exit(0) sourceCatType = inputPars.get_value('sourceCatalogueType','Selavy') sourceCat = readCat(sourceCatFile,sourceCatType) print sourceCatFile refCatFile = inputPars.get_value('refCatalogue','') if(refCatFile == ''): logging.error('Eval.refCatalogue not provided. Doing no evaluation.') exit(0) if(not os.access(refCatFile,os.F_OK)): logging.error("Eval.refCatalogue %s does not exist. Doing no evaluation."%refCatFile) exit(0)