rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
mags = n.empty(len(phi), dtype='float') | mags = n.empty(len(phiarray), dtype='float') | def manyMagCalc(self, phiarray, wavelen_step): """Calculate many magnitudes for many bandpasses using a single sed. |
if ((self.parameters.has_key(name) == False)): raise ValueError("Entry %s does not exist in data"%name) | if ((self.parameters.has_key(name[0]) == False)): raise ValueError("Entry %s does not exist in data"%name[0]) | def validateMetadata(self, dataType): """ Validate that the metadata contains the correct attributes |
mags = n.empty(len(bandpasslist), dtype='float') | mags = n.empty(len(phi), dtype='float') | def manyMagCalc(self, phiarray, wavelen_step): """Calculate many magnitudes for many bandpasses using a single sed. |
rootdir = rootdir + 'MLTY_dwarfs' | rootdir = rootdir + 'mlt' | def __init__(self, sedlist=None, rootdir='seds', type=None, verbose=True): """Initialize Seds with in list sedlist, in directory dir with root name root""" if sedlist == None: if rootdir!='': rootdir = rootdir + "/" if verbose: print "No files specified." print "Will try to read all seds known to be of type %s from %s%... |
tdwarflist = [] | bdwarflist = [] | def readRedDwarfs(self, rootdir='', verbose=True): """Initialize all cool red MLT dwarf seds""" sedlist=[] mdwarflist = [] ldwarflist = [] tdwarflist = [] tmplist = os.listdir(rootdir) for tmp in tmplist: if file[:1]=='m': mdwarflist.append(file) if (file[:1]=='l') | (file[:1]=="L"): ldwarflist.append(file) if file[:1]... |
if file[:1]=='m': mdwarflist.append(file) if (file[:1]=='l') | (file[:1]=="L"): ldwarflist.append(file) if file[:1]=='t': tdwarflist.append(file) if file[:4]=='burr': bdwarflist.append(file) sedlist = mdwarflist + ldwarflist + tdwarflist + bdwarflist | if tmp[:1]=='m': mdwarflist.append(tmp) if (tmp[:1]=='l') | (tmp[:1]=="L"): ldwarflist.append(tmp) if tmp[:1]=='t': tdwarflist.append(tmp) if tmp[:4]=='burr': bdwarflist.append(tmp) sedlist = mdwarflist + ldwarflist + bdwarflist | def readRedDwarfs(self, rootdir='', verbose=True): """Initialize all cool red MLT dwarf seds""" sedlist=[] mdwarflist = [] ldwarflist = [] tdwarflist = [] tmplist = os.listdir(rootdir) for tmp in tmplist: if file[:1]=='m': mdwarflist.append(file) if (file[:1]=='l') | (file[:1]=="L"): ldwarflist.append(file) if file[:1]... |
self.tdwarflist = tdwarflist | def readRedDwarfs(self, rootdir='', verbose=True): """Initialize all cool red MLT dwarf seds""" sedlist=[] mdwarflist = [] ldwarflist = [] tdwarflist = [] tmplist = os.listdir(rootdir) for tmp in tmplist: if file[:1]=='m': mdwarflist.append(file) if (file[:1]=='l') | (file[:1]=="L"): ldwarflist.append(file) if file[:1]... | |
if file[-4:]=='.dat': sedlist.append(file) if file[:2]=='C_': Cstarlist.append(file) if file[:2]=='O_': Ostarlist.append(file) | if tmp[-4:]=='.dat': sedlist.append(tmp) if tmp[:2]=='C_': Cstarlist.append(tmp) if tmp[:2]=='O_': Ostarlist.append(tmp) | def readAGBStars(self, rootdir='', verbose=True): """ Initialize all AGB stars """ sedlist = [] Cstarlist = [] Ostarlist = [] tmplist = os.listdir(rootdir) for tmp in tmplist: if file[-4:]=='.dat': sedlist.append(file) if file[:2]=='C_': Cstarlist.append(file) if file[:2]=='O_': Ostarlist.append(file) self.sedlist, sel... |
if file[-4:]=='.dat': sedlist.append(file) | if tmp[-4:]=='.dat': sedlist.append(tmp) | def readAsteroids(self, rootdir='', verbose=True): """ Initialize all asteroid seds""" sedlist = [] tmplist = os.listdir(rootdir) for tmp in tmplist: if file[-4:]=='.dat': sedlist.append(file) self.sedlist, self.seds = self.readSeds(sedlist, rootdir=rootdir, verbose=verbose) self.type='asteroid' return |
for filter in filters.filterlist: | for filter in bandpassSet.filterlist: | def calcEffObjLambdasDict(self, bandpassSet): """Calculate the effective wavelengths for these seds, in each of the filters. Returns dictionary of effective wavelengths for each SED (keyed by sedname) and keys""" effobjlambda = {} for sedname in self.sedlist: effobjlambda[sedname] = {} if self.seds[sedname].fnu.sum() ... |
return mags, filters.filterlist | return mags, bandpassSet.filterlist | def calcMagsDict(self, bandpassSet, verbose=False): """ Given a set of seds, calculate the magnitudes using a set of filters""" """ Returns magnitude dictionary (keyed sed / bandpass) """ mags = {} if verbose: # print out magnitudes header printstring = "# " for filter in bandpassSet.filterlist: printstring = pri... |
if self.needResample(wavelen, wavelen_min, wavelen_max, wavelen_step): | if self.needResample(wavelen=wavelen, wavelen_min=wavelen_min, wavelen_max=wavelen_max, wavelen_step=wavelen_step): | def writeSED(self, filename, print_header=None, print_fnu=False, wavelen_min=None, wavelen_max=None, wavelen_step=None): """Write SED (wavelen, flambda, optional fnu) out to file. Option of adding a header line (such as version info) to output file. Does not alter self, regardless of grid or presence/absence of fnu"""... |
print >> f, self.wavelen[i], self.flambda[i], self.fnu[i] | fnu = self.flambdaTofnu(wavelen=wavelen, flambda=flambda) print >> f, wavelen[i], flambda[i], fnu[i] | def writeSED(self, filename, print_header=None, print_fnu=False, wavelen_min=None, wavelen_max=None, wavelen_step=None): """Write SED (wavelen, flambda, optional fnu) out to file. Option of adding a header line (such as version info) to output file. Does not alter self, regardless of grid or presence/absence of fnu"""... |
print >> f "%.2f %.7g" %(self.wavelen[i], self.flambda[i]) | print >> f, "%.2f %.7g" %(wavelen[i], flambda[i]) | def writeSED(self, filename, print_header=None, print_fnu=False, wavelen_min=None, wavelen_max=None, wavelen_step=None): """Write SED (wavelen, flambda, optional fnu) out to file. Option of adding a header line (such as version info) to output file. Does not alter self, regardless of grid or presence/absence of fnu"""... |
def imsimBandpass(self, imsimwavelen=5000, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): | def imsimBandpass(self, imsimwavelen=500, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): | def imsimBandpass(self, imsimwavelen=5000, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Populate bandpass data with sb=0 everywhere except sb=1 at imsimwavelen. Sets wavelen/sb, with grid min/max/step as optional parameters. Does NOT set phi. """ # Set up arrays. self.wavelen = n.arang... |
x = 1.0 / wavelen * 10000.0 | nm_to_micron = 1/1000.0 x = 1.0 / (wavelen * nm_to_micron) | def setupCCMab(self, wavelen=None): """Calculate a(x) and b(x) for CCM dust model. (x=1/wavelen). Returns a(x) and b(x) can be common to many seds, wavelen is the same. """ # This extinction law taken from Cardelli, Clayton and Mathis ApJ 1989. # The general form is A_l / A(V) = a(x) + b(x)/R_V (where x=1/lambda in m... |
a_x[condition] = 1 + 0.17699*y - 0.50447*y**2 - 0.02427*y**3 + 0.72085*y**4 a_x[condition] = a_x[condition] + 0.01979*y**5 - 0.77530*y**6 + 0.32999*y**7 b_x[condition] = 1.41338*y + 2.28305*y**2 + 1.07233*y**3 - 5.38434*y**4 b_x[condition] = b_x[condition] - 0.62251*y**5 + 5.30260*y**6 - 2.09002*y**7 | a_x[condition] = 1 + 0.104*y - 0.609*y**2 + 0.701*y**3 + 1.137*y**4 a_x[condition] = a_x[condition] - 1.718*y**5 - 0.827*y**6 + 1.647*y**7 - 0.505*y**8 b_x[condition] = 1.952*y + 2.908*y**2 - 3.989*y**3 - 7.985*y**4 b_x[condition] = b_x[condition] + 11.102*y**5 + 5.491*y**6 - 10.805*y**7 + 3.347*y**8 | def setupCCMab(self, wavelen=None): """Calculate a(x) and b(x) for CCM dust model. (x=1/wavelen). Returns a(x) and b(x) can be common to many seds, wavelen is the same. """ # This extinction law taken from Cardelli, Clayton and Mathis ApJ 1989. # The general form is A_l / A(V) = a(x) + b(x)/R_V (where x=1/lambda in m... |
phiarray = n.empty((len(bandpasslist), len(bandpasslist[0].phi)), dtype='float') | phiarray = n.empty((len(bandpasslist), len(bandpasslist[0].wavelen)), dtype='float') | def setupPhiArray(self, bandpasslist): """Sets up a 2-d numpy phi array from bandpasslist suitable for input to manyMagCalc. |
def imsimBandpass(self, imsimwavelen=500, | def imsimBandpass(self, imsimwavelen=500.0, | def imsimBandpass(self, imsimwavelen=500, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Populate bandpass data with sb=0 everywhere except sb=1 at imsimwavelen. Sets wavelen/sb, with grid min/max/step as optional parameters. Does NOT set phi. """ # Set up arrays. self.wavelen = n.arange... |
self.sb[self.wavelen==imsimwavelen] = 1.0 | self.sb[abs(self.wavelen-imsimwavelen)<wavelen_step/2.0] = 1.0 | def imsimBandpass(self, imsimwavelen=500, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Populate bandpass data with sb=0 everywhere except sb=1 at imsimwavelen. Sets wavelen/sb, with grid min/max/step as optional parameters. Does NOT set phi. """ # Set up arrays. self.wavelen = n.arange... |
need_grid = !(n.all(wavelen_match==wavelen)) | need_grid = n.any(abs(wavelen_match-wavelen)>1e-10) | def needResample(self, wavelen_match=None, wavelen=None, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Check if wavelen or self.wavelen matches wavelen or wavelen_min/max/step grid.""" # Check if should use self or passed wavelen. if wavelen==None: wavelen = self.wavelen # Check if wavel... |
raise Exception("Environment variable CATALOG_DESCRIPTION_PATH not set to location of the catalog description files") | raise Exception("Environment variable SED_DATA not set to location of the catalog description files") | def __init__(self, objtype = 'STARS', filetypes=('TRIM',), chunksize=100000): if os.environ.has_key("CATALOG_DESCRIPTION_PATH"): catalogDescriptionPath = os.environ["CATALOG_DESCRIPTION_PATH"] else: raise Exception("Environment variable CATALOG_DESCRIPTION_PATH not set to location of the catalog description files") if ... |
self.rootSEDdir+"/ssmSed/",withErrors=False) | self.rootSEDdir+"/ssmSED/",withErrors=False) | def makeMovingObjectsFromOrbitList(self, results): objects = [] ephem_datfile = "" pyoorb.pyoorb.oorb_init(ephemeris_fname=ephem_datfile) for r in results: #Hack since there are no sedfilenames in the db at the moment mymo = mo.MovingObject(r['q'], r['e'], r['i'], r['node'], r['argPeri'], r['timePeri'], r['epoch'], mag... |
wavelength/flambda/fnu onto an even grid with these values. Defaults would be 300/1200/0.1. """ self.flambdaTofnu() | wavelength/flambda/fnu onto an even grid with these values. """ | def synchronizeSED(self, wavelen_min=None, wavelen_max=None, wavelen_step=None): """Set all wavelen/flambda/fnu values, potentially on min/max/step grid. |
resampleSED(wavelen_min=wavelen_min, wavelen_max=wavelen_max, wavelen_step=wavelen_step) | self.resampleSED(wavelen_min=wavelen_min, wavelen_max=wavelen_max, wavelen_step=wavelen_step) self.flambdaTofnu() | def synchronizeSED(self, wavelen_min=None, wavelen_max=None, wavelen_step=None): """Set all wavelen/flambda/fnu values, potentially on min/max/step grid. |
wavelen, fnu = self.flambdaTofnu() if normflux=='fnu': | wavelen, fnu = self.flambdaTofnu(wavelen, flambda) elif normflux=='fnu': | def renormalizeSED(self, wavelen=None, flambda=None, fnu=None, lambdanorm=500, normvalue=1, gap=0, normflux='flambda', wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Renormalize sed in flambda to have normflux=normvalue @ lambdanorm or averaged over gap. Can normalized in flambda or fnu ... |
nic = InstanceCatalog.InstanceCatalog() | nic = InstanceCatalog() | def makeCatalogFromQuery(self, result): if os.environ.has_key("CATALOG_DESCRIPTION_PATH"): catalogDescriptionPath = os.environ["CATALOG_DESCRIPTION_PATH"] else: raise Exception("Environment variable CATALOG_DESCRIPTION_PATH not set to location of the catalog description files") nic = InstanceCatalog.InstanceCatalog() n... |
print "Tarkistuspiste 1\n"; | def alignSeqs(seqs,*rest): "Stubb for alignment. Does nothing really" l=max(map(len,seqs)) return (0,[xseq.ljust(l).replace(" ","-") for xseq in seqs]) | |
print "Tarkistuspiste 2\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 3\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 4\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 5\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 6\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 7\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 8\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 9\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 10\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste11\n"; print "Tarkistuspiste 12\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
print "Tarkistuspiste 13\n"; | def formatAlnSeq(alns,names,starts,motifAln="",linelen=60): """Formats the DNA sequence alignment output""" outstr="\n".join(["Sequence %d: %s"%(seqI+1,iname) for (seqI,iname) in enumerate(names)])+"\n\n" n=len(alns[0]) poses=[xstart+1 for xstart in starts] for i in range(0,n,linelen): lines=[xaln[i:i+linelen] for xaln... | |
def fake_keypress(self, key): | def fake_keypress(self, keyName): | def fake_keypress(self, key): keyName = keyName.replace('\n', "<enter>") self.interface.fake_keypress(keyName) |
return ConfigManager(autoKeyApp) | c = ConfigManager(autoKeyApp) autoKeyApp.init_global_hotkeys(c) return c | def get_config_manager(autoKeyApp, hadError=False): if os.path.exists(CONFIG_FILE_OLD) and not os.path.exists(CONFIG_FILE): return load_legacy_config(autoKeyApp) elif os.path.exists(CONFIG_FILE): _logger.info("Loading config from existing file: " + CONFIG_FILE) pFile = open(CONFIG_FILE, 'r') try: configData = json.loa... |
self.mapChanged = False | def __init__(self, mediator, app): threading.Thread.__init__(self) self.setDaemon(True) self.setName("XInterface-thread") self.mediator = mediator self.app = app self.localDisplay = display.Display() self.rootWindow = self.localDisplay.screen().root self.lock = threading.RLock() self.dpyLock = threading.RLock() self.la... | |
if self.mapChanged: | if len(self.unmapCodes) > 0: | def finish_send(self): if self.mapChanged: unmapCodes = self.unmapCodes mapping = self.localDisplay.get_keyboard_mapping(min(unmapCodes), max(unmapCodes) - min(unmapCodes) + 1) firstCode = min(unmapCodes) |
keyCode = 9 | keyCode = 8 | def __getAvailableKeycodes(self): keyCode = 9 avail = [] for keyCodeMapping in self.localDisplay.get_keyboard_mapping(keyCode, 150): codeAvail = True for offset in keyCodeMapping: if offset != 0: codeAvail = False break |
for keyCodeMapping in self.localDisplay.get_keyboard_mapping(keyCode, 150): | for keyCodeMapping in self.localDisplay.get_keyboard_mapping(keyCode, 200): | def __getAvailableKeycodes(self): keyCode = 9 avail = [] for keyCodeMapping in self.localDisplay.get_keyboard_mapping(keyCode, 150): codeAvail = True for offset in keyCodeMapping: if offset != 0: codeAvail = False break |
mapChanged = False | def send_string(self, string): """ Send a string of printable characters. """ logger.debug("Sending string: %r", string) mapChanged = False remapChars = [] | |
self.mapChanged = True | def send_string(self, string): """ Send a string of printable characters. """ logger.debug("Sending string: %r", string) mapChanged = False remapChars = [] | |
self.mapChanged = True | if availCodes[-1] not in self.unmapCodes: self.unmapCodes.append(availCodes[-1]) | def send_string(self, string): """ Send a string of printable characters. """ logger.debug("Sending string: %r", string) mapChanged = False remapChars = [] |
return self.get_window_title(windowvar.query_tree().parent) | if wmclass == "": return self.get_window_title(windowvar.query_tree().parent) else: return wmclass[0] | def get_window_title(self, window=None): self.dpyLock.acquire() try: if window is None: windowvar = self.localDisplay.get_input_focus().focus else: windowvar = window wmname = windowvar.get_wm_name() wmclass = windowvar.get_wm_class() if (wmname == None) and (wmclass == None): return self.get_window_title(windowvar.qu... |
if item.check_hotkey(modifiers, key, windowName): | if item.check_hotkey(modifiers, rawKey, windowName): | def handle_keypress(self, rawKey, modifiers, key, windowName): logger.debug("Raw key: %r, modifiers: %r, Key: %r", rawKey, modifiers, key) # Always check global hotkeys for hotkey in self.configManager.globalHotkeys: hotkey.check_hotkey(modifiers, rawKey, windowName) if self.__shouldProcess(windowName): itemMatch = N... |
if folder.check_hotkey(modifiers, key, windowName): | if folder.check_hotkey(modifiers, rawKey, windowName): | def handle_keypress(self, rawKey, modifiers, key, windowName): logger.debug("Raw key: %r, modifiers: %r, Key: %r", rawKey, modifiers, key) # Always check global hotkeys for hotkey in self.configManager.globalHotkeys: hotkey.check_hotkey(modifiers, rawKey, windowName) if self.__shouldProcess(windowName): itemMatch = N... |
if not validate(not EMPTY_FIELD_REGEX.match(text), _("The script code can't be empty"), self.editor, | if not validate(not EMPTY_FIELD_REGEX.match(text), _("The phrase content can't be empty"), self.editor, | def validate(self): text = self.buffer.get_text(self.buffer.get_start_iter(), self.buffer.get_end_iter()).decode("utf-8") if not validate(not EMPTY_FIELD_REGEX.match(text), _("The script code can't be empty"), self.editor, self.parentWindow.ui): return False |
def findBestFWHM(self,tries,rename_images=False,default_fit=P2,min_stars=5): | def findBestFWHM(self,tries,rename_images=False,default_fit=P2,min_stars=15): | def findBestFWHM(self,tries,rename_images=False,default_fit=P2,min_stars=5): # X is FWHM, Y is offset value self.focpos=[] self.fwhm=[] fwhm_min = None self.fwhm_MinimumX = None keys = tries.keys() keys.sort() for k in keys: self.focpos.append(k) if rename_images: tries[k] = self.rename(tries[k],'%b/focusing/%o/%f') tr... |
self.focpos.append(k) | def findBestFWHM(self,tries,rename_images=False,default_fit=P2,min_stars=5): # X is FWHM, Y is offset value self.focpos=[] self.fwhm=[] fwhm_min = None self.fwhm_MinimumX = None keys = tries.keys() keys.sort() for k in keys: self.focpos.append(k) if rename_images: tries[k] = self.rename(tries[k],'%b/focusing/%o/%f') tr... | |
pi = re.match(r'^\!P.I.:\s*(\w.*)$', line) | pi = re.match(r'^ | def parsePiProg(self,line): pi = re.match(r'^\!P.I.:\s*(\w.*)$', line) if pi: self.pi = pi.group(1) return program = re.match(r'!Program:\s*(\w.*)$', line) if program: self.program = program.group(1) return |
program = re.match(r'!Program:\s*(\w.*)$', line) | program = re.match(r'^ | def parsePiProg(self,line): pi = re.match(r'^\!P.I.:\s*(\w.*)$', line) if pi: self.pi = pi.group(1) return program = re.match(r'!Program:\s*(\w.*)$', line) if program: self.program = program.group(1) return |
if l[0] == '!': | if l[0] == ' | def run(self): for arg in sys.argv[1:]: sched = open(arg) for l in sched.readlines(): l=l.rstrip() if (len(l) == 0): continue if l[0] == '!': self.parsePiProg(l) continue a = l.split() if a[0][0] == '#': continue scripts = a[3].split(',') if (a[2][0] != '-' and a[2][0] != '+'): a[2] = '+' + a[2] self.run_cmd(["rts2-new... |
for i in range(0,self.flatNum): | for i in range(0,len(self.flatImages)): | def run(self): # make sure we are taking light images.. self.setValue('SHUTTER','LIGHT') # choose filter sequence.. if (self.isEvening()): self.usedFlats = self.eveningFlats self.runEvening() else: self.usedFlats = self.morningFlats self.runMorning() |
if (not (self.isSubWindow())): | if (not (self.isSubWindow)): | def acquireImage(self): """Acquires images for flats. Return 0 if image was added to flats, 1 if it was too brigth, -1 if it was too dark.""" self.setValue('exposure',self.exptime) img = self.exposure(self.beforeReadout) avrg = self.getValueFloat('average') # Calculate average of image (can be just the central 100x100p... |
scripts = a[3].split(',') | def run(self): for arg in sys.argv[1:]: sched = open(arg) for l in sched.readlines(): l=l.rstrip() if (len(l) == 0): continue if l[0] == '#' and l[1] == '!': self.parsePiProg(l) continue a = l.split() if a[0][0] == '#': continue scripts = a[3].split(',') if (a[2][0] != '-' and a[2][0] != '+'): a[2] = '+' + a[2] self.ru... | |
script = 'tempdisable 1800 {1}'.format(tempdis,script) | script = 'tempdisable 1800 {0}'.format(script) | def run(self): for arg in sys.argv[1:]: sched = open(arg) for l in sched.readlines(): l=l.rstrip() if (len(l) == 0): continue if l[0] == '#' and l[1] == '!': self.parsePiProg(l) continue a = l.split() if a[0][0] == '#': continue scripts = a[3].split(',') if (a[2][0] != '-' and a[2][0] != '+'): a[2] = '+' + a[2] self.ru... |
mimsg['Subject'] = 'Flats report from %s' % (self.observatoryName) mimsg['To'] = self.email | mimsg['Subject'] = 'Flats report from %s' % (observatoryName) mimsg['To'] = email | def sendEmail(self,email,observatoryName): msg = 'Flats finished at %s.\n\nGood flats: %s\nBad flats: %s\n\n' % (datetime.today(),string.join(map(Flat.signature,self.goodFlats),';'),string.join(map(Flat.signature,self.badFlats),';')) for flat in self.usedFlats: msg += "\n\n" + flat.signature() + ':\n' + flat.attemptStr... |
s.sendmail('robtel@example.com',self.email.split(','),mimsg.as_string()) | s.sendmail('robtel@example.com',email.split(','),mimsg.as_string()) | def sendEmail(self,email,observatoryName): msg = 'Flats finished at %s.\n\nGood flats: %s\nBad flats: %s\n\n' % (datetime.today(),string.join(map(Flat.signature,self.goodFlats),';'),string.join(map(Flat.signature,self.badFlats),';')) for flat in self.usedFlats: msg += "\n\n" + flat.signature() + ':\n' + flat.attemptStr... |
os.system("logger %s could not find one or more of fits key words IMGID, BINNING and OBJECT in hdulist of %s" % (sys.argv[0], self.fits_tmp_path)) | os.system("logger %s could not find one or more of fits key words IMGID, BINNING and OBJECT in hdulist of %s" % (sys.argv[0], sys.argv[1])) | def main(self): if len(sys.argv) == 1: print 'Usage: %s <fits filename>' % (sys.argv[0]) os.system("logger %s Usage: %s fits_filename" % (sys.argv[0], sys.argv[0])) sys.exit(1) |
os.system( 'logger %s do not understand binning %s in %s' % (sys.argv[0], binning, self.fits_tmp_path)) | os.system( 'logger %s do not understand binning %s in %s' % (sys.argv[0], binning, sys.argv[1])) | def main(self): if len(sys.argv) == 1: print 'Usage: %s <fits filename>' % (sys.argv[0]) os.system("logger %s Usage: %s fits_filename" % (sys.argv[0], sys.argv[0])) sys.exit(1) |
os.system("logger %s could not find one or more of fits key words CRVAL1, CRVAL2, ORIRA, ORIDEC in hdulist of %s" % (sys.argv[0], self.fits_tmp_path)) | os.system("logger %s could not find one or more of fits key words CRVAL1, CRVAL2, ORIRA, ORIDEC in hdulist of %s" % (sys.argv[0], sys.argv[1])) | def main(self): if len(sys.argv) == 1: print 'Usage: %s <fits filename>' % (sys.argv[0]) os.system("logger %s Usage: %s fits_filename" % (sys.argv[0], sys.argv[0])) sys.exit(1) |
os.system("logger %s return values to EXEC %d %f %f \(%f,%f\)" % ( sys.argv[0], imgId, crval1, crval2, crval1- orira, crval2- oridec)) print '%d %f %f (%f,%f)\n' % ( imgId, crval1, crval2, crval1- orira, crval2- oridec) | os.system("logger %s return values to EXEC for %s %d %f %f \(%f,%f\)" % ( sys.argv[0], sys.argv[1], imgId, crval1, crval2, crval1- orira, crval2- oridec)) print '%d %f %f (%f,%f)' % ( imgId, crval1, crval2, crval1- orira, crval2- oridec) | def main(self): if len(sys.argv) == 1: print 'Usage: %s <fits filename>' % (sys.argv[0]) os.system("logger %s Usage: %s fits_filename" % (sys.argv[0], sys.argv[0])) sys.exit(1) |
brightnes = 'OK' | brightness = 'OK' | def acquireImage(self): """Acquires images for flats. Return 0 if image was added to flats, 1 if it was too brigth, -1 if it was too dark.""" self.setValue('exposure',self.exptime) img = self.exposure(self.beforeReadout) avrg = self.getValueFloat('average') # Calculate average of image (can be just the central 100x100p... |
opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw=", "delete="]) | opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw=", "title=", "event=", "place=", "end="]) | def main(): """Runs the CalendarExample application with the provided username and and password values. Authentication credentials are required. NOTE: It is recommended that you run this sample using a test account.""" # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw=", "de... |
end = a | end = time.gmtime(time.time() + int(a)) | def main(): """Runs the CalendarExample application with the provided username and and password values. Authentication credentials are required. NOTE: It is recommended that you run this sample using a test account.""" # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw=", "de... |
if user == '' or pw == '' or tilte == '' or event == '' or place == '' or end == '': | if user == '' or pw == '' or title == '' or event == '' or place == '' or end == '': | def main(): """Runs the CalendarExample application with the provided username and and password values. Authentication credentials are required. NOTE: It is recommended that you run this sample using a test account.""" # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw=", "de... |
see = self._InsertSingleEvent(title, event, place, start, end) | see = sample._InsertSingleEvent(title, event, place, time.strftime('%Y-%m-%dT%H:%M:%S.000Z', start), time.strftime('%Y-%m-%dT%H:%M:%S.000Z', end)) | def main(): """Runs the CalendarExample application with the provided username and and password values. Authentication credentials are required. NOTE: It is recommended that you run this sample using a test account.""" # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw=", "de... |
def sendCommand(self,comamnd,device = None): | def sendCommand(self,command,device = None): | def sendCommand(self,comamnd,device = None): """Send command to device.""" if device is None: print 'command',command else: print 'C',device,command sys.stdout.flush() |
self.morningFlats = None | self.morningFlats = morningFlats | def __init__(self,eveningFlats=[Flat(None)],morningFlats=None,doDarks=True,expTimes=range(1,20)): # Configuration (filters, binning, ..) for evening, we will use # reverse for morning. You fill array with Flat objects, which # describes configuration. If you do not have filters, use None # for filter name. self.evenin... |
dark = self.exposure(exp) | self.setValue('exposure',exp) dark = self.exposure() | def takeDarks(self): """Take flats dark images in spare time.""" self.setValue('SHUTTER','DARK') while (True): for exp in self.usedExpTimes: sun_alt = self.getValueFloat('sun_alt','centrald') next = self.getValueInteger('next','EXEC') if (sun_alt >= -0.5 or not (next == 2 or next == -1)): self.setValue('SHUTTER','LIGHT... |
self.log('W','average is bellow bias: average %f bias %f. Please adjust BiasLevel in flats script.' % avrg, self.BiasLevel) | self.log('W','average is bellow bias: average %f bias %f. Please adjust BiasLevel in flats script.' % (avrg, self.BiasLevel)) | def acquireImage(self): """Acquires images for flats. Return 0 if image was added to flats, 1 if it was too brigth, -1 if it was too dark.""" self.setValue('exposure',self.exptime) img = self.exposure(self.beforeReadout) avrg = self.getValueFloat('average') # Calculate average of image (can be just the central 100x100p... |
self.step= 1 | self.step = 0.2 | def __init__(self): self.exptime = 10 self.step= 1 self.attempts = 20 self.focuser = 'F0' |
self.setValue('FOC_FOFF',0,self.focuser) | self.setValue('FOC_TOFF',0,self.focuser) | def beforeReadout(self): if (self.num == self.attempts): self.setValue('FOC_FOFF',0,self.focuser) else: self.setValue('FOC_FOFF',self.off) |
self.setValue('FOC_FOFF',self.off) | self.setValue('FOC_TOFF',self.off,self.focuser) | def beforeReadout(self): if (self.num == self.attempts): self.setValue('FOC_FOFF',0,self.focuser) else: self.setValue('FOC_FOFF',self.off) |
self.setValue('FOC_FOFF',self.off,self.focuser) | self.setValue('FOC_TOFF',self.off,self.focuser) | def run(self): self.setValue('exposure',self.exptime) self.setValue('SHUTTER','LIGHT') self.off = -1 * self.step * (self.attempts / 2) self.setValue('FOC_FOFF',self.off,self.focuser) tries = {} |
if (ratio > (1.0 - self.optimalRange - self.allowedOptimalDeviation)): | if (self.isEvening ()): | def optimalExpTime(self,ratio,expMulti): exptime = expMulti * self.exptime / ratio # We adjust the exposure time for the next exposure, so that it is close to the optimal value if (exptime < self.expTimes[0]): if (ratio > (1.0 - self.optimalRange - self.allowedOptimalDeviation)): return self.startExpTime return self.ex... |
if (ratio < (1.0 + self.optimalRange + self.allowedOptimalDeviation)): return self.startExpTime return self.expTimes[-1] | if (self.isEvening ()): return self.expTimes[-1] return self.startExpTime | def optimalExpTime(self,ratio,expMulti): exptime = expMulti * self.exptime / ratio # We adjust the exposure time for the next exposure, so that it is close to the optimal value if (exptime < self.expTimes[0]): if (ratio > (1.0 - self.optimalRange - self.allowedOptimalDeviation)): return self.startExpTime return self.ex... |
if (imgstatus == -1): | if (imgstatus == -1 and self.exptime >= self.expTimes[-1]): | def executeEvening(self): self.exptime = self.startExpTime |
if (imgstatus == 1): | if (imgstatus == 1 and self.exptime <= self.expTimes[0]): | def executeMorning(self): self.exptime = self.startExpTime |
next = self.getValueInteger('next','EXEC') if (sun_alt >= -0.5 or not (next == 2 or next == -1)): | next_t = self.getValueInteger('next','EXEC') if (sun_alt >= -0.5 or not (next_t == 2 or next_t == -1)): | def takeDarks(self): """Take flats dark images in spare time.""" self.setValue('SHUTTER','DARK') while (True): for exp in self.usedExpTimes: sun_alt = self.getValueFloat('sun_alt','centrald') next = self.getValueInteger('next','EXEC') if (sun_alt >= -0.5 or not (next == 2 or next == -1)): self.setValue('SHUTTER','LIGHT... |
max = numpy.max(d) | flat_max = numpy.max(d) | def createMasterFits(self,of,files): """Process acquired flat images.""" import numpy import os import pyfits |
m = m / max | m = m / flat_max | def createMasterFits(self,of,files): """Process acquired flat images.""" import numpy import os import pyfits |
self.log ('writing %s of min: %f max: %f mean: %f std: %f median: %f' % (of,numpy.min(m),max,numpy.mean(m),numpy.std(m),numpy.median(numpy.median(m)))) | self.log ('writing %s of min: %f max: %f mean: %f std: %f median: %f' % (of,numpy.min(m),flat_max,numpy.mean(m),numpy.std(m),numpy.median(numpy.median(m)))) | def createMasterFits(self,of,files): """Process acquired flat images.""" import numpy import os import pyfits |
script = parse_script(a[4]) | script = 'tempdisable 1800 ' + parse_script(a[6]) | def parse_script(scr): ret = '' s = scr.split(',') for se in s: fil = se.split('-') ret += 'filter=' + fil[0] + ' '; if (fil[2] > 1): ret += 'for ' + fil[2] + ' { E ' + fil[1] + ' }' else: ret += 'E ' + fil[1] ret += ' ' return ret |
cmd = ["rts2-target", "-e", "-p", str(int(a[7]) * 100), a[0]] | prior = int(a[9]) * 100 if (prior <= 0): prior = 1 cmd = ["rts2-target", "-b", "0", "-e", "-p", str(prior), a[0]] | def parse_script(scr): ret = '' s = scr.split(',') for se in s: fil = se.split('-') ret += 'filter=' + fil[0] + ' '; if (fil[2] > 1): ret += 'for ' + fil[2] + ' { E ' + fil[1] + ' }' else: ret += 'E ' + fil[1] ret += ' ' return ret |
def _Rts2Event(self, title, content, where, start_time, end_time): """Inserts new RTS2 event. Returns event reference, which can be used for modification of the event.""" | def _InsertEvent(self, title='Tennis with Beth', content='Meet for a quick lesson', where='On the courts', start_time=None, end_time=None, recurrence_data=None): """Inserts a basic event using either start_time/end_time definitions or gd:recurrence RFC2445 icalendar syntax. Specifying both types of dates is not valid.... | def _Rts2Event(self, title, content, where, start_time, end_time): """Inserts new RTS2 event. Returns event reference, which can be used for modification of the event.""" event = gdata.calendar.CalendarEventEntry() event.title = atom.Title(text=title) event.content = atom.Content(text=content) event.where.append(gdata.... |
event.when.append(gdata.calendar.When(start_time=start_time, end_time=end_time)) new_event = self.cal_client.InsertEvent(event, '/calendar/feeds/default/private/full') | if recurrence_data is not None: event.recurrence = gdata.calendar.Recurrence(text=recurrence_data) else: if start_time is None: start_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime()) end_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime(time.time() + 3600)) event.when.append(gdata.calendar.When(... | def _Rts2Event(self, title, content, where, start_time, end_time): """Inserts new RTS2 event. Returns event reference, which can be used for modification of the event.""" event = gdata.calendar.CalendarEventEntry() event.title = atom.Title(text=title) event.content = atom.Content(text=content) event.where.append(gdata.... |
def _Rts2Observation(self, target_name, target_id, observation_id, start_time): """Insert new observation with link to observation preview.""" | def _InsertSingleEvent(self, title='One-time Tennis with Beth', content='Meet for a quick lesson', where='On the courts', start_time=None, end_time=None): """Uses the _InsertEvent helper method to insert a single event which does not have any recurrence syntax specified.""" new_event = self._InsertEvent(title, content... | def _Rts2Observation(self, target_name, target_id, observation_id, start_time): """Insert new observation with link to observation preview.""" # Create a WebContent object url = 'http://www.google.com/logos/worldcup06.gif' web_content = gdata.calendar.WebContent(url=url, width='276', height='120') # Create a WebConte... |
def _UpdateTitle(self, event, new_title='Updated event title'): """Updates the title of the specified event with the specified new_title. Note that the UpdateEvent method (like InsertEvent) returns the CalendarEventEntry object based upon the data returned from the server after the event is inserted. This represents t... | def _InsertWebContentGadgetEvent(self): """Creates a WebContent object and embeds it in a WebContentLink. The WebContentLink is appended to the existing list of links in the event entry. Finally, the calendar client inserts the event. Web content gadget events display Calendar Gadgets inside Google Calendar.""" | |
def flatLevels(self,optimalFlat=65536/3,optimalRange=0.3,allowedOptimalDeviation=0,biasLevel=0,defaultNumberFlats=9,sleepTime=1,maxDarkCycles=None,eveningMultiply=1,morningMultiply=1,shiftRa=10/3600,shiftDec=10/3600): | def flatLevels(self,optimalFlat=65536/3,optimalRange=0.3,allowedOptimalDeviation=0,biasLevel=0,defaultNumberFlats=9,sleepTime=1,maxDarkCycles=None,eveningMultiply=1,morningMultiply=1,shiftRa=10/3600.0,shiftDec=10/3600.0): | def flatLevels(self,optimalFlat=65536/3,optimalRange=0.3,allowedOptimalDeviation=0,biasLevel=0,defaultNumberFlats=9,sleepTime=1,maxDarkCycles=None,eveningMultiply=1,morningMultiply=1,shiftRa=10/3600,shiftDec=10/3600): """Set flat levels. Adjust diferent parameters of the algorithm. |
results = [r for r in q] text = "// REMARK From database\n" | results = q.fetch(1000) | def get_structure(pdb_id): q = Structure.all() q.filter("id =", pdb_id) results = [r for r in q] text = "// REMARK From database\n" if len(results) == 0: return None elif len(results) == 1: text += results[0].text else: pairs = [(r.i_text_block, r) for r in results] pairs.sort() for i, s in pairs: text += s.text return... |
elif len(results) == 1: | text = "// REMARK From database\n" if len(results) == 1: | def get_structure(pdb_id): q = Structure.all() q.filter("id =", pdb_id) results = [r for r in q] text = "// REMARK From database\n" if len(results) == 0: return None elif len(results) == 1: text += results[0].text else: pairs = [(r.i_text_block, r) for r in results] pairs.sort() for i, s in pairs: text += s.text return... |
html_template = html_template.replace( 'login_url', users.create_login_url(request_path)) | def html_user_replace(html_template, request_path): html_template = html_template.replace( 'login_url', users.create_login_url(request_path)) user_prefs = get_user_prefs() user = user_prefs.user if user is None: html_template = html_template.replace('user_status', 'login') html_template = html_template.replace('user_ni... | |
if user_prefs.user: logging.info('user_prefs of ' + user_prefs.user.nickname()) else: logging.info('user_prefs none') | def get(self): user_prefs = get_user_prefs() if user_prefs.user: logging.info('user_prefs of ' + user_prefs.user.nickname()) else: logging.info('user_prefs none') | |
blobs_str += "<a href='/serve/%s'>structure %s</a> <br>" \ | blobs_str += "<a href='/serve/%s'>blob %s</a> <br>" \ | def get(self): user_prefs = get_user_prefs() if user_prefs.user: logging.info('user_prefs of ' + user_prefs.user.nickname()) else: logging.info('user_prefs none') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.