rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
min(textsPeriodInSeconds * 4, self._MINIMUM_MESSAGE_PERIOD) | max(textsPeriodInSeconds * 4, self._MINIMUM_MESSAGE_PERIOD) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = self._DEFAULTS[key] elif quant < 0: defaults[key] = state_machine.INFINITE_PERIOD self._username = None self._password = None |
if args: self._report_new_message("No arguments supported") return try: for machine in self._conn.session.stateMachine._machines: machine.reset_timers() | try: args = args.strip().lower() if not args: args = "all" if args == "all": for machine in self._conn.session.stateMachine._machines: machine.reset_timers() elif args == "contacts": self._conn.session.addressbookStateMachine.reset_timers() elif args == "voicemail": self._conn.session.voicemailsStateMachine.reset_time... | def do_reset_state_machine(self, args): if args: self._report_new_message("No arguments supported") return |
self._report_new_message("Reset the refreshing state machine") | self._report_new_message("""Reset the refreshing state machine. "reset_state_machine" - resets all "reset_state_machine all" "reset_state_machine contacts" "reset_state_machine voicemail" "reset_state_machine texts" """) | def help_reset_state_machine(self): self._report_new_message("Reset the refreshing state machine") |
contactCapabilities = dbus.Dictionary( (self.text_chat_class, self.audio_chat_class), signature="sv", ) | contactCapabilities = (self.text_chat_class, self.audio_chat_class) | def GetContactCapabilities(self, handles): if 0 in handles: raise telepathy.InvalidHandle('Contact handle list contains zero') |
handleStatus = "Is New!" if isNewHandle else "From Cache" _moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus)) | if isNewHandle: handleStatus = "Is New!" if isNewHandle else "From Cache" _moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus)) | def _create_handle(connection, type, *args): Handle = _HANDLE_TYPE_MAPPING[type] key = Handle, connection.username, args try: handle = cache[key] isNewHandle = False except KeyError: # The misnamed get_handle_id requests a new handle id handle = Handle(connection, connection.get_handle_id(), *args) cache[key] = handle ... |
_moduleLogger.info("%s Skipping conversation for %r because '%s'" % (self._name, key, e)) | _moduleLogger.debug("%s Skipping conversation for %r because '%s'" % (self._name, key, e)) | def update(self, force=False): if not force and self._conversations: return |
if time[-2] == "PN": | if time.endswith("PM"): | def google_strptime(time): """ Hack: Google always returns the time in the same locale. Sadly if the local system's locale is different, there isn't a way to perfectly handle the time. So instead we handle implement some time formatting """ abbrevTime = time[:-3] parsedTime = datetime.datetime.strptime(abbrevTime, "%... |
(newMessage, newConversation.time) | (newMessage, newConversation) | def _report_conversation(self, mergedConversations): newConversations = mergedConversations.conversations if not newConversations: _moduleLogger.info( "No messages ended up existing for %r" % (self._contactKey, ) ) return |
for newMessage, convTime in messages: | now = datetime.datetime.now() for newMessage, conv in messages: if self.OLDEST_MESSAGE_WINDOW < (now - conv.time): _moduleLogger.warning("Why are we reporting a message that is so old?") _moduleLogger.warning("\t%r %r (%r) with %r messages" % (conv.number, conv.id, conv.time, len(conv.messages))) | def _report_conversation(self, mergedConversations): newConversations = mergedConversations.conversations if not newConversations: _moduleLogger.info( "No messages ended up existing for %r" % (self._contactKey, ) ) return |
self._report_new_message(formattedMessage, convTime) | self._report_new_message(formattedMessage, conv.time) | def _report_conversation(self, mergedConversations): newConversations = mergedConversations.conversations if not newConversations: _moduleLogger.info( "No messages ended up existing for %r" % (self._contactKey, ) ) return |
(number), | (number, ), | def _call(self, args): if not args: self._report_new_message("Must specify the phone number and only the phone nunber") return |
af.attributes = data['ordering'] | attrs=[] idx=0 for o in data['ordering']: try: num=data['data'][o].shape[1] if data['data'][o].dtype == numpy.double: prefix='double' elif data['data'] == numpy.int: prefix='int' else: prefix='string' except AttributeError: num=len(data['data'][o]) prefix='string' except IndexError: num=len(data['data'][o]) if data['da... | def write(self, data): self.check_sparse(data['data']) |
tk=[] tk_sort=[] tk_pr=[] tk_po=[] split_str=str(split_str) tk_split=re.findall("(^|,)(\d+:\d+)|(\d+)",split_str) for i in range(len(tk_split)): if tk_split[i][2]!='': tk.append(tk_split[i][2]) tk_pr.append(int(tk[-1])) tk_po.append(int(tk[-1])+1) if tk_split[i][1]!='': tk.append(tk_split[i][1]) tk_pr.append(int(tk[-1]... | tk=[] tk_sort=[] tk_pr=[] tk_po=[] | def reduce_split_str(split_str): tk=[] tk_sort=[] tk_pr=[] tk_po=[] split_str=str(split_str) tk_split=re.findall("(^|,)(\d+:\d+)|(\d+)",split_str) for i in range(len(tk_split)): if tk_split[i][2]!='': tk.append(tk_split[i][2]) tk_pr.append(int(tk[-1])) tk_po.append(int(tk[-1])+1) if tk_split[i][1]!='': tk.append(tk_spl... |
tk=numpy.array(tk) tk_pr=numpy.array(tk_pr) tk_po=numpy.array(tk_po) | if type(split_str) in [list,numpy.ndarray,numpy.matrix]: split_str=', '.join([str(i) for i in split_str]) else: split_str=str(split_str) | def reduce_split_str(split_str): tk=[] tk_sort=[] tk_pr=[] tk_po=[] split_str=str(split_str) tk_split=re.findall("(^|,)(\d+:\d+)|(\d+)",split_str) for i in range(len(tk_split)): if tk_split[i][2]!='': tk.append(tk_split[i][2]) tk_pr.append(int(tk[-1])) tk_po.append(int(tk[-1])+1) if tk_split[i][1]!='': tk.append(tk_spl... |
sindex=tk_pr.argsort() tk=tk[sindex] tk_pr=tk_pr[sindex] tk_po=tk_po[sindex] | tk_split=re.findall("(^|,)(\d+:\d+)|(\d+)",split_str) for i in range(len(tk_split)): if tk_split[i][2]!='': tk.append(tk_split[i][2]) tk_pr.append(int(tk[-1])) tk_po.append(int(tk[-1])+1) if tk_split[i][1]!='': tk.append(tk_split[i][1]) tk_pr.append(int(tk[-1].split(":")[0])) tk_po.append(int(tk[-1].split(":")[1])) | def reduce_split_str(split_str): tk=[] tk_sort=[] tk_pr=[] tk_po=[] split_str=str(split_str) tk_split=re.findall("(^|,)(\d+:\d+)|(\d+)",split_str) for i in range(len(tk_split)): if tk_split[i][2]!='': tk.append(tk_split[i][2]) tk_pr.append(int(tk[-1])) tk_po.append(int(tk[-1])+1) if tk_split[i][1]!='': tk.append(tk_spl... |
if len(tk) == 1: return tk tk_reduce=[] akt=0 red_ind=0 aktstr=str(tk_pr[0]) for i in range(1,len(tk)): if (tk_pr[i]==tk_po[i-1]): akt+=1 else: if akt>0: aktstr+=":"+str(tk_po[i-1]) tk_reduce.append(aktstr) aktstr=str(tk_pr[i]) akt=0 else: tk_reduce.append(tk[i-1]) aktstr=str(tk_pr[i]) if i==len(tk)-1: if akt>0: akts... | tk=numpy.array(tk) tk_pr=numpy.array(tk_pr) tk_po=numpy.array(tk_po) sindex=tk_pr.argsort() tk=tk[sindex] tk_pr=tk_pr[sindex] tk_po=tk_po[sindex] if len(tk) == 1: return tk tk_reduce=[] akt=0 red_ind=0 aktstr=str(tk_pr[0]) for i in range(1,len(tk)): if (tk_pr[i]==tk_po[i-1]): akt+=1 else: if akt>0: aktstr+=":"+str(... | def reduce_split_str(split_str): tk=[] tk_sort=[] tk_pr=[] tk_po=[] split_str=str(split_str) tk_split=re.findall("(^|,)(\d+:\d+)|(\d+)",split_str) for i in range(len(tk_split)): if tk_split[i][2]!='': tk.append(tk_split[i][2]) tk_pr.append(int(tk[-1])) tk_po.append(int(tk[-1])+1) if tk_split[i][1]!='': tk.append(tk_spl... |
group.attrs['pub_date'] = _encode(task.pub_date) group.attrs['version'] = task.version group.attrs['slug'] = _encode(task.slug.text) group.attrs['summary'] = _encode(task.summary) group.attrs['description'] = _encode(task.description) group.attrs['urls'] = _encode(task.urls) group.attrs['publications'] =\ ''.join([_enc... | update_object(group, 'pub_date', _encode(task.pub_date)) update_object(group, 'version', task.version) update_object(group, 'slug', _encode(task.slug.text)) update_object(group, 'summary', _encode(task.summary)) update_object(group, 'description', _encode(task.description)) update_object(group, 'urls', _encode(task.url... | def update_description(h5, task): """Update description group in Task file. @param h5: opened HDF5 file @type h5: h5py.File @param task: Task object as of mldata.org @type task: repository.Task @return: if update was successful @rtype: boolean """ if not 'task_descr' in h5: group = h5.create_group('task_descr') else:... |
group.attrs['data_heldback'] = _encode(task.data_heldback.name) group.attrs['license'] = _encode(task.license.name) group.attrs['tags'] = _encode(task.tags) | update_object(group, 'data_heldback', _encode(task.data_heldback.name)) update_object(group, 'license', _encode(task.license.name)) update_object(group, 'tags', _encode(task.tags)) | def update_description(h5, task): """Update description group in Task file. @param h5: opened HDF5 file @type h5: h5py.File @param task: Task object as of mldata.org @type task: repository.Task @return: if update was successful @rtype: boolean """ if not 'task_descr' in h5: group = h5.create_group('task_descr') else:... |
h5.attrs['name'] = _encode(task.name) h5.attrs['mldata'] = VERSION_MLDATA h5.attrs['comment'] = 'Task file' | update_object(h5, 'name', _encode(task.name)) update_object(h5, 'mldata', VERSION_MLDATA) update_object(h5, 'comment', 'Task file') | def create(fname, task, taskfile=None): """Update or create Task file with data from given Task object. @param fname: full path of Task filename @type fname: string @param task: Task object as of mldata.org @type task: repository.Task @param taskfile: data to write to Task file @type taskfile: dict with indices train_... |
vname = '/data' + name | vname = '/data/' + name | def get_num_instattr(fname): """Retrieve number of instances and number of attributes from given HDF5 file. @param fname: filename to retrieve data from @type fname: string @return: number of instances and number of attributes @rtype: tuple containing 2 integers """ try: h5 = h5py.File(fname, 'r') num_inst = 0 num_att... |
update_object(group, 'is_public', _encode(task.is_public)) update_object(group, 'is_deleted', _encode(task.is_deleted)) update_object(group, 'is_current', _encode(task.is_current)) update_object(group, 'user', _encode(task.user.username)) update_object(group, 'downloads', task.downloads) update_object(group, 'hits', ta... | def update_description(h5, task): """Update description group in Task file. @param h5: opened HDF5 file @type h5: h5py.File @param task: Task object as of mldata.org @type task: repository.Task @return: if update was successful @rtype: boolean """ if not 'task_descr' in h5: group = h5.create_group('task_descr') else:... | |
update_object(h5, 'name', _encode(task.name)) update_object(h5, 'mldata', VERSION_MLDATA) update_object(h5, 'comment', 'Task file') | h5.attrs['name'] = _encode(task.name) h5.attrs['mldata'] = VERSION_MLDATA h5.attrs['comment'] = 'Task file' | def create(fname, task, taskfile=None): """Update or create Task file with data from given Task object. @param fname: full path of Task filename @type fname: string @param task: Task object as of mldata.org @type task: repository.Task @param taskfile: data to write to Task file @type taskfile: dict with indices train_... |
if attr.shape ==(1,1): | if attr.shape ==(1,1) or attr.shape==(1,): | def _print_meta(self,attr,name): """Return a string of metainformation |
return meta | def _print_meta(self,attr,name): """Return a string of metainformation | |
meta+=' | try: meta+=' except IndexError: meta+=' | def _print_meta(self,attr,name): """Return a string of metainformation |
meta+=' except IndexError: meta+=' try: meta+=' | meta+=' | def _print_meta(self,attr,name): """Return a string of metainformation |
extract.append(A[:NUM_EXTRACT].tolist()) | extract.extend(A[:NUM_EXTRACT].tolist()) | def _get_extract_data(h5): """Get extract data from given HDF5 object. @param h5: HDF5 file to get extract from @type h5: HDF5 file @return: data extract @rtype: list """ extract = [] try: for dset in h5['/data_descr/ordering']: dset = '/data/' + dset dset_indptr = dset+'_indptr' dset_indices = dset+'_indices' if ds... |
if 'names' in h5.keys(): | if '/data_descr/names' in h5: | def read(self): """Get data and description in-memory |
header=self.readline(15) | header=octf.readline(15) | def _check_header(self, octf): """evidence of octave conformity (disabled) |
while line.startswith(' | while line and line.startswith(' | def _next_attr(self, octf): """Returns the next atribute in the octave file |
lpos=octf.tell() while (not line.startswith(' | while line and not line.startswith(' | def _next_attr(self, octf): """Returns the next atribute in the octave file |
lpos=octf.tell() | def _next_attr(self, octf): """Returns the next atribute in the octave file | |
octf.seek(lpos) | def _next_attr(self, octf): """Returns the next atribute in the octave file | |
while attr['name']!='': | while attr and attr['name']!='': | def read(self): data={} names=[] octf = open(self.fname, 'r') |
attr=self._next_attr() | attr=self._next_attr(octf) | def read(self): data={} names=[] octf = open(self.fname, 'r') |
(name,dtype,len,col)=self._read_meta(octf) if not dtype=='sq_string': | meta=self._read_meta(octf) if not meta['dtype']=='sq_string': | def _read_cellarray(self,octf,col,row): """Returns the next cellarray atribute in the octave file |
data.append(self._read_sq_string(octf,len,col)) | data.append(self._read_sq_string(octf,meta['length'],meta['elements'])) | def _read_cellarray(self,octf,col,row): """Returns the next cellarray atribute in the octave file |
return numpy.array(data) | out = numpy.array(data) if out.shape[0]==1: out.shape=(out.shape[1],) print 'read data', out.shape, len(data),':' , len(data[0]) return out | def _read_matrix(self,octf,col,row): """Returns the data of a matrix atribute in the octave file |
'names':[], | 'names':names, | def read(self): data={} names=[] octf = open(self.fname, 'r') |
else: | elif len(attr.shape)==1: if attr_num==None: meta+=' meta+=' meta+=' else: meta+=' try: meta+=' except IndexError: meta+=' try: meta+=' except IndexError: meta+=' else: | def _print_meta(self,attr,name): """Return a string of metainformation |
attr_num=self._num_matrix(attr) | def _print_data(self, attr): """Return a string of data | |
data=str(attr[0][0]) + '\n' | data=str(attr_num[0][0]) + '\n' | def _print_data(self, attr): """Return a string of data |
data=str(attr[0]) + '\n' else: for i in attr: | data=str(attr_num[0]) + '\n' elif len(attr.shape)==2: for i in attr_num: | def _print_data(self, attr): """Return a string of data |
if j==int(j): j=int(j) | def _print_data(self, attr): """Return a string of data | |
num=data['data'][o].shape[1] | if len(data['data'][o].shape)==1: num=1 else: num=data['data'][o].shape[0] | def write(self, data): self.check_sparse(data['data']) |
elif data['data'] == numpy.int: | elif data['data'][o].dtype == numpy.int: | def write(self, data): self.check_sparse(data['data']) |
prefix='string' except AttributeError: num=len(data['data'][o]) prefix='string' except IndexError: num=len(data['data'][o]) if data['data'][o].dtype == numpy.double: prefix='double' elif data['data'] == numpy.int: prefix='int' else: prefix='string' | prefix='str' except AttributeError: num=1 prefix='str' | def write(self, data): self.check_sparse(data['data']) |
print tmp_data data=csc_matrix((tmp_data[2],(tmp_data[0]-1,tmp_data[1]-1)),shape=(col,row)) | data=csc_matrix((tmp_data[2],(tmp_data[0]-1,tmp_data[1]-1)),shape=(row,col)) | def _read_sparse_matrix(self,octf,col,row): """Returns the next sparse matrix in the octave file |
print type(attr) | def _print_data(self, attr): """Return a string of data | |
group['pub_date'] = _encode(task.pub_date)) | group['pub_date'] = _encode(task.pub_date) | def update_description(h5, task): """Update description group in Task file. @param h5: opened HDF5 file @type h5: h5py.File @param task: Task object as of mldata.org @type task: repository.Task @return: if update was successful @rtype: boolean """ if not 'task_descr' in h5: group = h5.create_group('task_descr') else:... |
path_indptr = dset+'_indptr' path_indices = dset+'_indices' | path_indptr = path+'_indptr' path_indices = path+'_indices' | def _find_dset(fname, output_variables): """Find the dataset in given contents that contains the output_variable(s). This would be easy if all the data was just in one blob, but it may be in several datasets as defined by contents['ordering'], e.g. in contents['label'] or contents['data'] or contents['nameofvariable']... |
if not line.endswith('\n') | if not line.endswith('\n'): | def infer_seperator(fname): """Infer seperator for variables in given file. @param fname: filename to retrieve data from @type fname: string @return: inferred seperator @rtype: string """ try: fp = open(fname, 'r') except: return None seperator = None minimum = 1 for i in xrange(3): # try the first 3 lines line = fp... |
contents['data'][name] = numpy.array(h5[vname],order='F').T | contents['data'][name] = numpy.array(h5[vname],order='F') | def read(self): """Get data and description in-memory |
left = Signal(intbv(min=Ll, max=Ml)) right = Signal(intbv(min=Lr, max=Mr)) | left = Signal(intbv(Ll, min=Ll, max=Ml)) right = Signal(intbv(Lr, min=Lr, max=Mr)) | def binaryBench(Ll, Ml, Lr, Mr): seqL = [] seqR = [] for i in range(NRTESTS): seqL.append(randrange(Ll, Ml)) seqR.append(randrange(Lr, Mr)) for j, k in ((Ll, Lr), (Ml-1, Mr-1), (Ll, Mr-1), (Ml-1, Lr)): seqL.append(j) seqR.append(k) seqL = tuple(seqL) seqR = tuple(seqR) aBit = Signal(bool(0)) left = Signal(intbv(min=... |
left = Signal(intbv(min=Ll, max=Ml)) right = Signal(intbv(min=Lr, max=Mr)) | left = Signal(intbv(Ll, min=Ll, max=Ml)) right = Signal(intbv(Lr, min=Lr, max=Mr)) | def augmBench( Ll, Ml, Lr, Mr): M = 2**17 seqL = [] seqR = [] for i in range(NRTESTS): seqL.append(randrange(Ll, Ml)) seqR.append(randrange(Lr, Mr)) for j, k in ((Ll, Lr), (Ml-1, Mr-1), (Ll, Mr-1), (Ml-1, Lr)): seqL.append(j) seqR.append(k) seqL = tuple(seqL) seqR = tuple(seqR) left = Signal(intbv(min=Ll, max=Ml)) r... |
func_name = frame.f_code.co_name if func_name in self.skipNames: self.skip = 1 | funcname = frame.f_code.co_name if funcname in self.skipNames: self.skip +=1 | def extractor(self, frame, event, arg): if event == "call": func_name = frame.f_code.co_name if func_name in self.skipNames: self.skip = 1 if not self.skip: self.level += 1 elif event == "return": if not self.skip: isGenSeq = _isGenSeq(arg) if isGenSeq: for hdl in _userCodeMap: key = "__%s__" % hdl if key in frame.... |
funcname = frame.f_code.co_name | def extractor(self, frame, event, arg): if event == "call": func_name = frame.f_code.co_name if func_name in self.skipNames: self.skip = 1 if not self.skip: self.level += 1 elif event == "return": if not self.skip: isGenSeq = _isGenSeq(arg) if isGenSeq: for hdl in _userCodeMap: key = "__%s__" % hdl if key in frame.... | |
func_name = frame.f_code.co_name if func_name in self.skipNames: self.skip = 0 | if funcname in self.skipNames: self.skip -= 1 | def extractor(self, frame, event, arg): if event == "call": func_name = frame.f_code.co_name if func_name in self.skipNames: self.skip = 1 if not self.skip: self.level += 1 elif event == "return": if not self.skip: isGenSeq = _isGenSeq(arg) if isGenSeq: for hdl in _userCodeMap: key = "__%s__" % hdl if key in frame.... |
raise ExtractHierarchyError(_error.InconsistentHierarchy % inst.name) | raise ExtractHierarchyError(_error.InconsistentHierarchy) | def __init__(self, name, dut, *args, **kwargs): global _profileFunc _memInfoMap.clear() for hdl in _userCodeMap: _userCodeMap[hdl].clear() self.skipNames = ('always_comb', 'always', '_always_decorator', 'instance', \ 'instances', 'processes', 'posedge', 'negedge') self.skip = 0 self.hierarchy = hierarchy = [] self.abs... |
print images.index(image), image['original'] | print images.index(image), os.path.splitext(image['original'])[0] + ".jpg" | def get_url(self, movie, arttype, interactive): if arttype == "poster": images = movie['images'].posters elif arttype == "backdrop": images = movie['images'].backdrops if len(images) == 0: return None if interactive: for image in images: print images.index(image), image['original'] sel = prompt_sel(images, arttype) els... |
return images[sel]['original'] | return os.path.splitext(images[sel]['original'])[0] + ".jpg" | def get_url(self, movie, arttype, interactive): if arttype == "poster": images = movie['images'].posters elif arttype == "backdrop": images = movie['images'].backdrops if len(images) == 0: return None if interactive: for image in images: print images.index(image), image['original'] sel = prompt_sel(images, arttype) els... |
help="Rescrape files and images") | help="Rescrape nfo files and art") | def save_all_fanart(self, filename, images): print "Fetching extra art" folder = os.path.dirname(filename) extrafolder = os.path.join(folder, "extrafanart") if not os.path.exists(extrafolder): os.mkdir(extrafolder) for image in images: index = images.index(image) + 1 imagepath = self.get_artpath(filename, image['origin... |
help="Do not fetch or create nfo") | help="Do not fetch IMDB or create nfo") | def save_all_fanart(self, filename, images): print "Fetching extra art" folder = os.path.dirname(filename) extrafolder = os.path.join(folder, "extrafanart") if not os.path.exists(extrafolder): os.mkdir(extrafolder) for image in images: index = images.index(image) + 1 imagepath = self.get_artpath(filename, image['origin... |
help="Do not fetch art") | help="Do not fetch TMDB art") | def save_all_fanart(self, filename, images): print "Fetching extra art" folder = os.path.dirname(filename) extrafolder = os.path.join(folder, "extrafanart") if not os.path.exists(extrafolder): os.mkdir(extrafolder) for image in images: index = images.index(image) + 1 imagepath = self.get_artpath(filename, image['origin... |
print "Fetching extra art" | def save_all_fanart(self, filename, images): abspath = os.path.abspath(filename) folder = os.path.dirname(abspath) print "Fetching extra art" extrafolder = os.path.join(folder, "extrafanart") print "extra:", extrafolder if not os.path.exists(extrafolder): os.mkdir(extrafolder) for image in images: index = images.index(... | |
print "extra:", extrafolder | def save_all_fanart(self, filename, images): abspath = os.path.abspath(filename) folder = os.path.dirname(abspath) print "Fetching extra art" extrafolder = os.path.join(folder, "extrafanart") print "extra:", extrafolder if not os.path.exists(extrafolder): os.mkdir(extrafolder) for image in images: index = images.index(... | |
folder = os.path.dirname(filename) | def save_all_fanart(self, filename, images): print "Fetching extra art" folder = os.path.dirname(filename) extrafolder = os.path.join(folder, "extrafanart") if not os.path.exists(extrafolder): os.mkdir(extrafolder) for image in images: index = images.index(image) + 1 imagepath = self.get_artpath(filename, image['origin... | |
base = os.path.splitext(imagepath)[0] | base = os.path.splitext(os.path.basename(imagepath))[0] | def save_all_fanart(self, filename, images): print "Fetching extra art" folder = os.path.dirname(filename) extrafolder = os.path.join(folder, "extrafanart") if not os.path.exists(extrafolder): os.mkdir(extrafolder) for image in images: index = images.index(image) + 1 imagepath = self.get_artpath(filename, image['origin... |
write_out_template(cmb_dict["templatefile"], cmb_dict["soscriptname"], cmb_dict) cmb_jid = launch_qsub(cmb_dict["soscriptname"]) | write_out_template(cmb_dict["templatefile"], cmb_dict["cmbscriptname"], cmb_dict) cmb_jid = launch_qsub(cmb_dict["cmbscriptname"]) | def main(argv=None): """Process command line options, create qsub scripts and start execution.""" if not argv: argv = sys.argv #Default dictionary for templates template_dict = base_qsub_dict.copy() #Parse command line options parser = OptionParser() loggroup = OptionGroup(parser, "Log Options", "These options affe... |
self.J_terms = [self.J_factory(Jkey) for Jkey in J_params.iterkeys()] | self.J_terms = [self.J_factory(Jkey) for Jkey in self.J_params.iterkeys()] | def __init__(self, *args, **kwargs): """Class for slow roll source term equations""" super(NewFullSingleFieldSource, self).__init__(*args, **kwargs) self.J_params = {"A1": {"n":2, "dphiterm": "dp1", "pretermix":0}, "A2": {"n":3, "dphiterm": "dp1", "pretermix":0}, "A3": {"n":4, "dphiterm": "dp1", "pretermix":0}, "A4": {... |
@profile | def rkdriver_dumb(vstart, x1, x2, nstep, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps.""" v = vstart y = [v] #start results list xx = N.zeros(nstep+1) #initialize 1-dim array for x xx[0] = x = x1 # set both first xx and x to x1 h ... | |
set_trace() | def rkdriver_withks(vstart, simtstart, ts, te, allks, h, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps. Copes with multiple start times for different ks if they are sorted in terms of starting time.""" #Make sure h is specified if ... | |
onekshape = np.ones(self.k.shape) | onekshape = np.ones(k.shape) | def full_source_from_model(self, m, nix): """Use the data from a model at a timestep nix to calculate the full source term S.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background... |
C1 = 1/H**2 * (Vppp + phidot/a**2 * (3 * a**2 * Vpp + 2 * self.k**2 )) | C1 = 1/H**2 * (Vppp + phidot/a**2 * (3 * a**2 * Vpp + 2 * k**2 )) | def full_source_from_model(self, m, nix): """Use the data from a model at a timestep nix to calculate the full source term S.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background... |
C3 = -4.5 * phidot / (a*H**2) * self.k C4 = -phidot/(a*H**2) / self.k | C3 = -4.5 * phidot / (a*H**2) * k C4 = -phidot/(a*H**2) / k | def full_source_from_model(self, m, nix): """Use the data from a model at a timestep nix to calculate the full source term S.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background... |
C6 = 2 * phidot * self.k C7 = - phidot / self.k | C6 = 2 * phidot * k C7 = - phidot / k | def full_source_from_model(self, m, nix): """Use the data from a model at a timestep nix to calculate the full source term S.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background... |
onekshape = np.ones(self.k.shape) | onekshape = np.ones(k.shape) | def get_vars_from_model(self, m, nix): """Find and calculate variables from cosmomodels model.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background values not available for this ... |
C1 = 1/H**2 * (Vppp + phidot/a**2 * (3 * a**2 * Vpp + 2 * self.k**2 )) | C1 = 1/H**2 * (Vppp + phidot/a**2 * (3 * a**2 * Vpp + 2 * k**2 )) | def get_vars_from_model(self, m, nix): """Find and calculate variables from cosmomodels model.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background values not available for this ... |
C3 = -4.5 / (a*H**2) * self.k C4 = -phidot/(a*H**2) / self.k | C3 = -4.5 / (a*H**2) * k C4 = -phidot/(a*H**2) / k | def get_vars_from_model(self, m, nix): """Find and calculate variables from cosmomodels model.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background values not available for this ... |
C6 = 2 * phidot * self.k C7 = - phidot / self.k | C6 = 2 * phidot * k C7 = - phidot / k | def get_vars_from_model(self, m, nix): """Find and calculate variables from cosmomodels model.""" try: #Get background values phi, phidot, H = m.yresult[nix, 0:3, 0] a = m.ainit*np.exp(m.tresult[nix]) except AttributeError: raise if np.any(np.isnan(phi)): raise AttributeError("Background values not available for this ... |
set_trace() | def rkdriver_withks(vstart, simtstart, ts, te, allks, h, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps. Copes with multiple start times for different ks if they are sorted in terms of starting time.""" #Make sure h is specified if ... | |
J_general = 2*C*(1/(n*(n-1))*k**(n-1) + kmax**(n-1)/(n-1) - kmin**n/(k*n)) | J_general = 2*C*(-1/(n*(n-1))*k**(n-1) + kmax**(n-1)/(n-1) - kmin**n/(k*n)) | def J_general_Atype(self, k, C, n): kmin = k[0] kmax = k[-1] if n == 1: J_general = 2*C*(1/n * k**(n-1) - np.log(k) + np.log(kmax) - kmin**n/(k*n)) else: J_general = 2*C*(1/(n*(n-1))*k**(n-1) + kmax**(n-1)/(n-1) - kmin**n/(k*n)) return J_general |
set_trace() | def rkdriver_withks(vstart, simtstart, ts, te, allks, h, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps. Copes with multiple start times for different ks if they are sorted in terms of starting time.""" #Make sure h is specified if ... | |
kmax = kix.max() for oneix in xrange(kmax): if N.any(N.isnan(v[:,oneix])): v[:,oneix] = vstart[:,oneix] y[-1][:,kix] = v[:,kix] | if kix: kmax = kix.max() for oneix in xrange(kmax): if N.any(N.isnan(v[:,oneix])): v[:,oneix] = vstart[:,oneix] y[-1][:,kix] = v[:,kix] | def rkdriver_withks(vstart, simtstart, ts, te, allks, h, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps. Copes with multiple start times for different ks if they are sorted in terms of starting time.""" #Make sure h is specified if ... |
J_A = (4*alpha**2*((k + kmax)**2.5* (33*C1*(-2*k + 5*kmax) + C2*(-16*k**3 + 40*k**2*kmax - 70*k*kmax**2 + 105*kmax**3)) - (-k + kmax)**2.5*(33*C1*(2*k + 5*kmax) + C2*(16*k**3 + 40*k**2*kmax + 70*k*kmax**2 + 105*kmax**3))))/(3465.*k)\ - (4*alpha**2*((k + kmin)**2.5* (33*C1*(-2*k + 5*kmin) + C2*(-16*k**3 + 40*k**2*kmin -... | J_A = ((2*alpha**2*C1*kmax**3)/3. + (2*alpha**2*C2*kmax**5)/5. - (2*alpha**2*C1*kmin**3)/3. - (2*alpha**2*C2*kmin**5)/5.) | def J_A(self, k, alpha, C1, C2): """Solution for J_A which is the integral for A in terms of constants C1 and C2.""" #Set limits from k kmin = k[0] kmax = k[-1] J_A = (4*alpha**2*((k + kmax)**2.5* (33*C1*(-2*k + 5*kmax) + C2*(-16*k**3 + 40*k**2*kmax - 70*k*kmax**2 + 105*kmax**3)) - (-k + kmax)**2.5*(33*C1*(2*k + 5*kma... |
J_B = ((-4*alpha**2*((k + kmax)**2.5* (9*C3*(12*k**3 - 30*k**2*kmax + 25*k*kmax**2 - 10*kmax**3) + C4*(32*k**5 - 80*k**4*kmax + 140*k**3*kmax**2 - 210*k**2*kmax**3 + 165*k*kmax**4 - 66*kmax**5)) + (-k + kmax)**2.5*(9*C3* (12*k**3 + 30*k**2*kmax + 25*k*kmax**2 + 10*kmax**3) + C4*(32*k**5 + 80*k**4*kmax + 140*k**3*kmax**... | J_B = 0 | def J_B(self, k, alpha, C3, C4): """Solution for J_B which is the integral for B in terms of constants C3 and C4.""" kmax = k[-1] kmin = k[0] J_B = ((-4*alpha**2*((k + kmax)**2.5* (9*C3*(12*k**3 - 30*k**2*kmax + 25*k*kmax**2 - 10*kmax**3) + C4*(32*k**5 - 80*k**4*kmax + 140*k**3*kmax**2 - 210*k**2*kmax**3 + 165*k*kmax*... |
J_C = ((-16*Sqrt(2)*alpha**2*((0+1*1j) + beta)*C5*k**1.5*(-9*beta*k - (0+10*1j)*k**2))/ (315.*beta**2) + (4*alpha**2*((0+1*1j) + beta)*C5* (84*Sqrt(2)*k**3.5 - ((0+112*1j)*Sqrt(2)*k**4.5)/beta + ((0+24*1j)*Sqrt(2)*k**3.5*((0+5*1j)*beta + 3*k))/beta))/(315.*beta*k) - (4*alpha**2*((0+1*1j) + beta)*C5* (21*k*(k + kmax)**2... | J_C = ((2*alpha**2*(1*1j + beta)**2*C5*kmax**3)/(3.*beta**2) - (2*alpha**2*(1*1j + beta)**2*C5*kmin**3)/(3.*beta**2)) | def J_C(self, k, alpha, beta, C5): """Second method for J_C""" kmax = k[-1] kmin = k[0] J_C = ((-16*Sqrt(2)*alpha**2*((0+1*1j) + beta)*C5*k**1.5*(-9*beta*k - (0+10*1j)*k**2))/ (315.*beta**2) + (4*alpha**2*((0+1*1j) + beta)*C5* (84*Sqrt(2)*k**3.5 - ((0+112*1j)*Sqrt(2)*k**4.5)/beta + ((0+24*1j)*Sqrt(2)*k**3.5*((0+5*1j)*... |
J_D = ((-4*alpha**2*((0+1*1j) + beta)* (Sqrt(2)*Sqrt(k)*(-585*beta*(1870*C6*k**3 + 252*C7*k**5) - (0+77*1j)*(2002*C6*k**4 - 1800*C7*k**6)) + 90090*C6*(15*beta + (0+7*1j)*k)*k**3.5*ArcTanh(Sqrt(2))))/ (1.4189175e7*beta**2*k**2) + (4*alpha**2*((0+1*1j) + beta)* (Sqrt(k + kmin)*(-585*beta* (-21*C7*(k + kmin)**2* (12*k**3 ... | J_D = 0 | def J_D(self, k, alpha, beta, C6, C7): """Solution for J_D which is the integral for D in terms of constants C6 and C7.""" kmax = k[-1] kmin = k[0] J_D = ((-4*alpha**2*((0+1*1j) + beta)* (Sqrt(2)*Sqrt(k)*(-585*beta*(1870*C6*k**3 + 252*C7*k**5) - (0+77*1j)*(2002*C6*k**4 - 1800*C7*k**6)) + 90090*C6*(15*beta + (0+7*1j)*k... |
J_general = -2*C*(1/(n*(n-1))*k**(n-1) + kmax**(n-1)/(n-1) - kmin**n/(k*n)) | J_general = -2*C*(-1/(n*(n-1))*k**(n-1) + kmax**(n-1)/(n-1) - kmin**n/(k*n)) | def J_general_Atype(self, k, C, n): kmin = k[0] kmax = k[-1] if n == 1: J_general = -2*C*(1/n * k**(n-1) - np.log(k) + np.log(kmax) - kmin**n/(k*n)) else: J_general = -2*C*(1/(n*(n-1))*k**(n-1) + kmax**(n-1)/(n-1) - kmin**n/(k*n)) return J_general |
if console: | if options.console: | def main(argv=None): """Main function: deal with command line arguments and start calculation as reqd.""" if not argv: argv = sys.argv #Parse command line options parser = optparse.OptionParser() parser.add_option("-f", "--filename", action="store", dest="foresults", default=run_config.foresults, type="string", meta... |
if options.taskmax != options.taskmix: | if options.taskmax != options.taskmin: | def main(argv=None): """Main function: deal with command line arguments and start calculation as reqd.""" if not argv: argv = sys.argv #Parse command line options parser = optparse.OptionParser() parser.add_option("-f", "--filename", action="store", dest="foresults", default=run_config.foresults, type="string", meta... |
return f() | return f | def profile(f): return f() |
Q = 1/H2 * V * phidot + a2 * Vp | Q = a2 * (V * phidot + Vp) | def sourceterm(self, bgvars, a, potentials, dp1, dp1dot): """Return unintegrated slow roll source term. The source term before integration is calculated here using the slow roll approximation. This function follows the revised version of Eq (5.8) in Malik 06 (astro-ph/0610864v5). Parameters ---------- bgvars: tuple T... |
if kwargs["tix"] is None: raise ModelError("Need to specify tix in order to calculate 2nd order perturbation!") else: tix = kwargs["tix"] fotix = np.around((t - self.second_stage.simtstart)/self.second_stage.tstep_wanted) | fotix = np.int(np.around((t - self.second_stage.simtstart)/self.second_stage.tstep_wanted)) | def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r... |
self._log.debug("tix=%f, t=%f, fo.tresult[tix]=%f, fotix=%f", tix, t, self.second_stage.tresult[tix], fotix) | self._log.debug("t=%f, fo.tresult[tix]=%f, fotix=%f", t, self.second_stage.tresult[fotix], fotix) | def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r... |
fovars = self.second_stage.yresult[tix].copy()[:,kix] | fovars = self.second_stage.yresult[fotix].copy()[:,kix] | def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r... |
epsilon = self.second_stage.bgepsilon[tix] | epsilon = self.second_stage.bgepsilon[fotix] | def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r... |
src = self.source[tix][kix] | src = self.source[fotix][kix] | def derivs(self, y, t, **kwargs): """Equation of motion for second order perturbations including source term""" self._log.debug("args: %s", str(kwargs)) #If k not given select all if "k" not in kwargs or kwargs["k"] is None: k = self.k kix = np.arange(len(k)) else: k = kwargs["k"] kix = kwargs["kix"] if kix is None: r... |
set_trace() | def rkdriver_withks(vstart, simtstart, ts, te, allks, h, derivs): """Driver function for classical Runge Kutta 4th Order method. Starting at x1 and proceeding to x2 in nstep number of steps. Copes with multiple start times for different ks if they are sorted in terms of starting time.""" #set_trace() #Make sure h is s... | |
theta_terms[0,n] = romb(sinth*dphi_res[0], dx=self.theta) | theta_terms[0,n] = romb(sinth*dphi_res[0], dx=self.dtheta) | def getthetaterms(self, dp1, dp1dot): """Return array of integrated values for specified theta function and dphi function. Parameters ---------- dp1: array_like Array of values for dphi1 dp1dot: array_like Array of values for dphi1dot Returns ------- theta_terms: tuple Tuple of len(k)xlen(q) shaped arrays of integra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.