code
stringlengths
1
18.2k
in central_moments, with expressions depending only on central moments central_moments_exprs = self._substitute_raw_with_central(central_moments_exprs, central_from_raw_exprs, n_counter, k_counter) # Get final right hand side expressions for each moment in a vector mfk = self._generate_mass_fluctuation_kinetics(central...
def _generate_problem_left_hand_side(self, n_counter, k_counter): """ Generate the left hand side of the ODEs. This is simply the symbols for the corresponding moments. Note that, in principle, they are in of course fact the time derivative of the moments. :param n_counter: a list of :class:`~means.core.descriptors.Mom...
def _generate_mass_fluctuation_kinetics(self, central_moments, dmu_over_dt, n_counter): """ Generate the Mass Fluctuation Kinetics (i.e. the right hand side of the ODEs) :param central_moments: The matrix of central moment expressions :param dmu_over_dt: :param n_counter: a list of :class:`~means.core.descriptors.Momen...
def _substitute_raw_with_central(self, central_moments_exprs, central_from_raw_exprs, n_counter, k_counter): r""" Takes the expressions for central moments, and substitute the symbols representing raw moments, by equivalent expressions in terms of central moment :param central_moments_exprs: a matrix of expressions for...
And we solve this for the symbol of the corresponding raw moment. This gives an expression # of the symbol for raw moment in terms of central moments and lower order raw moment solved_xs = sp.Matrix([quick_solve(eq,raw) for (eq, raw) in zip(eq_to_solve, positiv_raw_moms_symbs)]) # now we want to express raw moments onl...
we finally build substitution pairs to replace all raw moments substitution_pairs = zip(positiv_raw_moms_symbs, solved_xs) # apply this substitution to all elements of the central moment expressions matrix out_exprs = substitute_all(central_moments_exprs, substitution_pairs) return out_exprs
def raw_to_central(n_counter, species, k_counter): """ Expresses central moments in terms of raw moments (and other central moments). Based on equation 8 in the paper: .. math:: \mathbf{M_{x^n}} = \sum_{k_1=0}^{n_1} ... \sum_{k_d=0}^{n_d} \mathbf{{n \choose k}} (-1)^{\mathbf{n-k}} \mu^{\mathbf{n-k}} \langle \mathbf{x^k...
create empty output central_in_terms_of_raw = [] # This loop loops through the ::math::`[n_1, ..., n_d]` vectors of the sums in the beginning of the equation # i.e. :math:`\sum_{k1=0}^n_1 ... \sum_{kd=0}^n_d` part of the equation. # Note, this is not the sum over k's in that equation, or at least I think its not for n_...
vector ::math::`[k_1, ..., k_d]` k_lower = [k for k in k_counter if n_iter >= k] # (n k) binomial term in equation 9 n_choose_k_vec = [make_k_chose_e(k_vec.n_vector, n_vec) for k_vec in k_lower] # (-1)^(n-k) term in equation 9 minus_one_pow_n_min_k_vec = [_make_min_one_pow_n_minus_k(n_vec, k_vec.n_vector) for k_vec in ...
def get_string(self, key): """Get a string from all_options""" if key not in self.all_options: kwargs = {} if len(self.chain) > 1: kwargs['source'] = Meta(self.all_options, self.chain[-2]).source raise BadOptionFormat("Can't find key in options", key=key, chain=self.chain, **kwargs) # Make sure we special case the "con...
def special_format_field(self, obj, format_spec): """Know about any special formats""" if format_spec == "env": return "${{{0}}}".format(obj) elif format_spec == "from_env": if obj not in os.environ: raise NoSuchEnvironmentVariable(wanted=obj) return os.environ[obj]
def main(): """ main """ try: sr71 = BlackBird() sr71.start() except BlackbirdError as error: sys.stderr.write(error.__str__() + '\n') return(1)
def _add_arguments(self, args): """ Add command line arguments to each section in config. e.x: before: [global] hoge = hoge after: { 'global': { 'hoge': 'hoge', 'arguments': { 'debug_mode': True, 'and_more': AND_MORE } } } """ update_dict = { 'arguments': vars(args) } for section in self.config.keys(): self.config[sect...
def _create_threads(self): """ This method creates job instances. """ creator = JobCreator( self.config, self.observers.jobs, self.logger ) self.jobs = creator.job_factory()
def start(self): """ main loop. """ def main_loop(): while True: threadnames = [thread.name for thread in threading.enumerate()] for job_name, concrete_job in self.jobs.items(): if job_name not in threadnames: new_thread = Executor( name=job_name, job=concrete_job['method'], logger=self.logger, interval=concrete_job['i...
def job_factory(self): """ Create concrete jobs. The concrete jobs is following dictionary. jobs = { 'PLUGINNAME-build_items': { 'method': FUNCTION_OBJECT, 'interval': INTERVAL_TIME , } ... } If ConcreteJob instance has "build_discovery_items", "build_discovery_items" method is added to jobs. warn: looped method is dep...
job_kls( options=options, queue=self.queue, logger=self.logger ) # Deprecated!! if hasattr(job_obj, 'looped_method'): self.logger.warn( ('{0}\'s "looped_method" is deprecated.' 'Pleases change method name to "build_items"' ''.format(plugin_name)) ) name = '-'.join([section, 'looped_method']) interval = 60 if 'interval'...
{0} (lld_interval {1})' ''.format(plugin_name, lld_interval) ) return jobs
def get_proxy_session(self): """Gets a ``ProxySession`` which is responsible for acquiring authentication credentials on behalf of a service client. :return: a proxy session for this service :rtype: ``osid.proxy.ProxySession`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``Unimplemented`` -- ``supp...
def get_grade_systems_by_search(self, grade_system_query, grade_system_search): """Pass through to provider GradeSystemSearchSession.get_grade_systems_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self._can('search'): raise Permission...
def get_grade_entries_by_search(self, grade_entry_query, grade_entry_search): """Pass through to provider GradeEntrySearchSession.get_grade_entries_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self._can('search'): raise PermissionDen...
def get_gradebook_columns_by_search(self, gradebook_column_query, gradebook_column_search): """Pass through to provider GradebookColumnSearchSession.get_gradebook_columns_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self._can('search...
def set_query_sequence(self,seq): """Assign the query sequence. :param seq: sequence of the query :type seq: string """ self._options = self._options.replace(query_sequence = seq)
def target_range(self): """Get the range covered on the target/reference strand :returns: Genomic range of the target strand :rtype: GenomicRange """ a = self.alignment_ranges return GenomicRange(a[0][0].chr,a[0][0].start,a[-1][0].end)
def actual_query_range(self): """This is the actual query range for the positive strand :returns: Range of query positive strand covered :rtype: GenomicRange """ a = self.alignment_ranges #return GenomicRange(a[0][1].chr,a[0][1].start,a[-1][1].end,self.get_strand()) if self.get_strand() == '+': return GenomicRange(a[0]...
def set_reference(self,ref): """Set the reference sequence :param ref: reference sequence :type ref: string """ self._options = self._options._replace(reference = ref)
def get_alignment_strings(self,min_intron_size=68): """Process the alignment to get information like the alignment strings for each exon. These strings are used by the pretty print. :returns: String representation of the alignment in an easy to read format :rtype: string """ qseq = self.query_sequence if not qseq: sys....
if dift < min_intron_size: if dift > 0: textra = str(ref[t.chr][t.start-dift-1:t.start-1]).upper() qextra = '-'*dift yextra = '\0'*dift elif difq > 0: textra = '-'*difq qextra = qseq[q.start-difq-1:q.start-1].upper() yextra = qual[q.start-difq-1:q.start-1] else: tarr.append(tdone) qarr.append(qdone) yarr.append(ydone) ...
def print_alignment(self,chunk_size=40,min_intron_size=68): """print the nice looking alignment. Must have data accessable from get_query_sequence() and get_refernece_sequencec() :returns: Pretty print string. :rtype: string """ has_qual = True if not self.query_quality: has_qual = False trantab = maketrans('01',' *') ...
def get_PSL(self,min_intron_size=68): """Get a PSL object representation of the alignment. :returns: PSL representation :rtype: PSL """ from seqtools.format.psl import PSL matches = sum([x[0].length for x in self.alignment_ranges]) # 1. Matches - Number of matching bases that aren't repeats stats = AlignmentStats(match...
str(qStart)+"\t"+\ str(qEnd)+"\t"+\ tName+"\t"+\ str(tSize)+"\t"+\ str(tStart)+"\t"+\ str(tEnd)+"\t"+\ str(blockCount)+"\t"+\ blockSizes+"\t"+\ qStarts+"\t"+\ tStarts return PSL(psl_string,PSL.Options(query_sequence=self.query_sequence,reference=self._options.reference,query_quality=self.query_quality))
def get_SAM(self,min_intron_size=68): """Get a SAM object representation of the alignment. :returns: SAM representation :rtype: SAM """ from seqtools.format.sam import SAM #ar is target then query qname = self.alignment_ranges[0][1].chr flag = 0 if self.strand == '-': flag = 16 rname = self.alignment_ranges[0][0].chr p...
"\t" + str(mapq) + "\t" + cigar + "\t" + \ rnext + "\t" + str(pnext) + "\t" + str(tlen) + "\t" + \ seq + "\t" + qual return SAM(ln,reference=self._reference)
def construct_cigar(self,min_intron_size=68): """Create a CIGAR string from the alignment :returns: CIGAR string :rtype: string """ # goes target query ar = self.alignment_ranges cig = '' if ar[0][1].start > 1: # soft clipped cig += str(ar[0][1].start-1)+'S' for i in range(len(ar)): exlen = ar[i][0].length cig += str(e...
def get_target_transcript(self,min_intron=1): """Get the mapping of to the target strand :returns: Transcript mapped to target :rtype: Transcript """ if min_intron < 1: sys.stderr.write("ERROR minimum intron should be 1 base or longer\n") sys.exit() #tx = Transcript() rngs = [self.alignment_ranges[0][0].copy()] #rngs[0...
def match_resource_id(self, resource_id, match): """Sets the resource ``Id`` for this query. arg: resource_id (osid.id.Id): a resource ``Id`` arg: match (boolean): ``true`` if a positive match, ``false`` for a negative match raise: NullArgument - ``resource_id`` is ``null`` *compliance: mandatory -- This method must be...
def match_objective_id(self, objective_id, match): """Sets the objective ``Id`` for this query. arg: objective_id (osid.id.Id): an objective ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``objective_id`` is ``null`` *compliance: mandatory -- This method...
def match_completion(self, start, end, match): """Sets the completion for this query to match completion percentages between the given range inclusive. arg: start (decimal): start of range arg: end (decimal): end of range arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: Invalid...
def match_level_id(self, grade_id, match): """Sets the level grade ``Id`` for this query. arg: grade_id (osid.id.Id): a grade ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``grade_id`` is ``null`` *compliance: mandatory -- This method must be implemente...
def GenomicRangeFromString(range_string,payload=None,dir=None): """Constructor for a GenomicRange object that takes a string""" m = re.match('^(.+):(\d+)-(\d+)$',range_string) if not m: sys.stderr.write("ERROR bad genomic range string\n"+range_string+"\n") sys.exit() chr = m.group(1) start = int(m.group(2)) end = int(m...
def copy(self): """Create a new copy of selfe. does not do a deep copy for payload :return: copied range :rtype: GenomicRange """ return type(self)(self.chr, self.start+self._start_offset, self.end, self.payload, self.dir)
def get_bed_array(self): """Return a basic three meber bed array representation of this range :return: list of [chr,start (0-indexed), end (1-indexed] :rtype: list """ arr = [self.chr,self.start-1,self.end] if self.dir: arr.append(self.dir) return arr
def equals(self,gr): """ check for equality. does not consider direction :param gr: another genomic range :type gr: GenomicRange :return: true if they are the same, false if they are not :rtype: bool """ if self.chr == gr.chr and self.start == gr.start and self.end == gr.end: return True return False
def get_range_string(self): """ get the range string represetation. similar to the default input for UCSC genome browser :return: representation by string like chr2:801-900 :rtype: string """ return self.chr+":"+str(self.start)+"-"+str(self.end)
def adjacent(self,rng2): """ Test for adjacency. :param rng2: :param use_direction: false by default :param type: GenomicRange :param type: use_direction """ if self.chr != rng2.chr: return False if self.direction != rng2.direction and use_direction: return False if self.end == rng2.start-1: return True if self.start-1...
def overlaps(self,in_genomic_range,padding=0): """do the ranges overlap? :param in_genomic_range: range to compare to :param padding: add to the ends this many (default 0) :type in_genomic_range: GenomicRange :type padding: int :return: True if they overlap :rtype: bool """ if padding > 0: in_genomic_range = GenomicRan...
in_genomic_range.end >= self.end: return True sys.stderr.write("overlaps: unprogrammed error\n") return False
def overlap_size(self,in_genomic_range): """ The size of the overlap :param in_genomic_range: the range to intersect :type in_genomic_range: GenomicRange :return: count of overlapping bases :rtype: int """ if self.chr != in_genomic_range.chr: return 0 if self.end < in_genomic_range.start: return 0 if in_genomic_range.e...
def merge(self,range2): """merge this bed with another bed to make a longer bed. Returns None if on different chromosomes. keeps the options of this class (not range2) :param range2: :type range2: GenomicRange :return: bigger range with both :rtype: GenomicRange """ if self.chr != range2.chr: return None o = type(self)...
def intersect(self,range2): """Return the chunk they overlap as a range. options is passed to result from this object :param range2: :type range2: GenomicRange :return: Range with the intersecting segement, or None if not overlapping :rtype: GenomicRange """ if not self.overlaps(range2): return None return type(self)(s...
def cmp(self,range2,overlap_size=0): """the comparitor for ranges * return 1 if greater than range2 * return -1 if less than range2 * return 0 if overlapped :param range2: :param overlap_size: allow some padding for an 'equal' comparison (default 0) :type range2: GenomicRange :type overlap_size: int """ if self.overlap...
def subtract(self,range2): """Take another range, and list of ranges after removing range2, keep options from self :param range2: :type range2: GenomicRange :return: List of Genomic Ranges :rtype: GenomicRange[] """ outranges = [] if self.chr != range2.chr: outranges.append(self.copy()) return outranges if not self.ove...
def distance(self,rng): """The distance between two ranges. :param rng: another range :type rng: GenomicRange :returns: bases separting, 0 if overlapped or adjacent, -1 if on different chromsomes :rtype: int """ if self.chr != rng.chr: return -1 c = self.cmp(rng) if c == 0: return 0 if c < 0: return rng.start - self.en...
def get_relationships(self): """Gets the relationship list resulting from a search. return: (osid.relationship.RelationshipList) - the relationship list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has alr...
def get_families(self): """Gets the family list resulting from a search. return: (osid.relationship.FamilyList) - the family list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been retrieved.') ...
def parse_log_entry(text): """This function does all real job on log line parsing. it setup two cases for restart parsing if a line with wrong format was found. Restarts: - use_value: just retuns an object it was passed. This can be any value. - reparse: calls `parse_log_entry` again with other text value. Beware, this...
def log_analyzer(path): """This procedure replaces every line which can't be parsed with special object MalformedLogEntry. """ with handle(MalformedLogEntryError, lambda (c): invoke_restart('use_value', MalformedLogEntry(c.text))): for filename in find_all_logs(path): analyze_log(filename)
def log_analyzer2(path): """This procedure considers every line which can't be parsed as a line with ERROR level. """ with handle(MalformedLogEntryError, lambda (c): invoke_restart('reparse', 'ERROR: ' + c.text)): for filename in find_all_logs(path): analyze_log(filename)
def init(db_url, api_url): """ Initialize the database server. Sets some configuration parameters on the server, creates the necessary databases for this project, pushes design documents into those databases, and sets up replication with the cloud server if one has already been selected. """ old_db_url = config["local_...
= None desired_val = '"{}"'.format(value.replace('"', '\\"')) if current_val != desired_val: status = server.resource.session.request( "PUT", url, body=desired_val )[0] # Unless there is some delay between requests, CouchDB gets # sad for some reason if status != 200: click.ClickException( 'Failed to set configuration ...
def clear(): """ Clear all data on the local server. Useful for debugging purposed. """ utils.check_for_local_server() click.confirm( "Are you sure you want to do this? It will delete all of your data", abort=True ) server = Server(config["local_server"]["url"]) for db_name in all_dbs: del server[db_name]
def load_fixture(fixture_file): """ Populate the database from a JSON file. Reads the JSON file FIXTURE_FILE and uses it to populate the database. Fuxture files should consist of a dictionary mapping database names to arrays of objects to store in those databases. """ utils.check_for_local_server() local_url = config["...
def update_module_types(): """ Download the repositories for all of the firmware_module_type records and update them using the `module.json` files from the repositories themselves. Currently only works for git repositories. """ local_url = config["local_server"]["url"] server = Server(local_url) db = server[FIRMWARE_MO...
def strip_comments(code): '''Returns the headers with comments removed. ''' single_comment = compile('//.*') # single line comment multi_comment = compile('/\\*\\*.*?\\*/', re.DOTALL) # multiline comment code = sub(single_comment, '', code) code = sub(multi_comment, '', code) return '\n'.join([c for c in code.splitline...
def parse_prototype(prototype): '''Returns a :attr:`FunctionSpec` instance from the input. ''' val = ' '.join(prototype.splitlines()) f = match(func_pat, val) # match the whole function if f is None: raise Exception('Cannot parse function prototype "{}"'.format(val)) ftp, pointer, name, arg = [v.strip() for v in f.grou...
def parse_struct(type_name, body, name): '''Returns a :attr:`StructSpec` instance from the input. ''' type_name, name = type_name.strip(), name.strip() lines = [l.strip() for l in body.splitlines() if l.strip()] members = [] for line in lines: m = match(variable_pat, line) if m is None: raise Exception('Cannot parse "{...
def parse_enum(type_name, body, name): '''Returns a :attr:`EnumSpec` instance from the input. ''' type_name, name = type_name.strip(), name.strip() lines = [l.strip(' ,') for l in body.splitlines() if l.strip(', ')] members = [] for line in lines: vals = [v.strip() for v in line.split('=')] if len(vals) == 1: members.a...
def parse_header(filename): '''Returns a list of :attr:`VariableSpec`, :attr:`FunctionSpec`, :attr:`StructSpec`, :attr:`EnumSpec`, :attr:`EnumMemberSpec`, and :attr:`TypeDef` instances representing the c header file. ''' with open(filename, 'rb') as fh: content = '\n'.join(fh.read().splitlines()) content = sub('\t', ' ...
else: res.append(parse_struct(*items[j + 1: j + 4])) j += 4 # now do remaining simple typedefs content = res res = [] for i, item in enumerate(content): if not isinstance(item, str): # if it's already processed skip it res.append(item) continue items = split(typedef_pat, item) for j, item in enumerate(items): res.appen...
def format_enum(enum_def): '''Returns a cython enum from a :attr:`EnumSpec` instance. ''' text = [] text.append('cdef enum {}:'.format(enum_def.tp_name)) for member in enum_def.values: if member.value: text.append('{}{} = {}'.format(tab, *member)) else: text.append('{}{}'.format(tab, member.name)) for name in enum_def....
def format_function(function): '''Returns a cython function from a :attr:`FunctionSpec` instance. ''' args = [format_variable(arg) for arg in function.args] return ['{}{} {}({})'.format( function.type, function.pointer, function.name, ', '.join(args))]
def format_struct(struct_def): '''Returns a cython struct from a :attr:`StructSpec` instance. ''' text = [] text.append('cdef struct {}:'.format(struct_def.tp_name)) text.extend( ['{}{}'.format(tab, format_variable(var)) for var in struct_def.members] ) for name in struct_def.names: text.append('ctypedef {} {}'.format(...
def dump_cython(content, name, ofile): '''Generates a cython pxi file from the output of :func:`parse_header`. ''' with open(ofile, 'wb') as fh: fh.write('cdef extern from "{}":\n'.format(name)) for item in content: if isinstance(item, FunctionSpec): code = format_function(item) elif isinstance(item, StructSpec): code ...
def parse_geometry(geometry): """Takes a geometry string, returns map of parameters.""" m = re.match("(\d+)x(\d+)([-+]\d+)([-+]\d+)", geometry) if not m: raise ValueError("failed to parse geometry string") return map(int, m.groups())
def buttons(self, master): """Adds 'OK' and 'Cancel' buttons to standard button frame. Override if need for different configuration. """ subframe = tk.Frame(master) subframe.pack(side=tk.RIGHT) ttk.Button( subframe, text="OK", width=10, command=self.ok, default=tk.ACTIVE ).pack(side=tk.LEFT, padx=5, pady=5) ttk.Button(...
def ok(self, event=None): """Function called when OK-button is clicked. This method calls check_input(), and if that returns ok it calls execute(), and then destroys the dialog. """ if not self.check_input(): self.initial_focus.focus_set() return self.withdraw() self.update_idletasks() try: self.execute() finally: self...
def cancel(self, event=None): """Function called when Cancel-button clicked. This method returns focus to parent, and destroys the dialog. """ if self.parent != None: self.parent.focus_set() self.destroy()
def set_payload(self,val): """Set a payload for this object :param val: payload to be stored :type val: Anything that can be put in a list """ self._options = self._options._replace(payload = val)
def avg_mutual_coverage(self,gpd): """get the coverage fraction of each transcript then return the geometric mean :param gpd: Another transcript :type gpd: Transcript :return: avg_coverage :rtype: float """ ov = self.overlap_size(gpd) if ov == 0: return 0 xfrac = float(ov) / float(self.get_length()) yfrac = float(ov) /...
def overlap_size(self,tx2): """Return the number of overlapping base pairs between two transcripts :param tx2: Another transcript :type tx2: Transcript :return: overlap size in base pairs :rtype: int """ total = 0 for e1 in self.exons: for e2 in tx2.exons: total += e1.overlap_size(e2) return total
def overlaps(self,tx2): """Return True if overlapping """ total = 0 for e1 in self.exons: for e2 in tx2.exons: if e1.overlap_size(e2) > 0: return True return False
def slice_target(self,chr,start,end): """Slice the mapping by the target coordinate First coordinate is 0-indexed start Second coordinate is 1-indexed finish """ # create a range that we are going to intersect with trng = Bed(chr,start,end) nrngs = [] for r in self._rngs: i = r.intersect(trng) if not i: continue nrngs....
def slice_sequence(self,start,end): """Slice the mapping by the position in the sequence First coordinate is 0-indexed start Second coordinate is 1-indexed finish """ #find the sequence length l = self.length indexstart = start indexend = end ns = [] tot = 0 for r in self._rngs: tot += r.length n = r.copy() if indexsta...
def sequence(self): """A strcutre is defined so get, if the sequence is not already there, get the sequence from the reference Always is returned on the positive strand for the MappingGeneric :param ref_dict: reference dictionary (only necessary if sequence has not been set already) :type ref_dict: dict() """ if not se...
def get_sequence(self,ref): """get a sequence given a reference""" strand = '+' if not self._options.direction: sys.stderr.write("WARNING: no strand information for the transcript\n") if self._options.direction: strand = self._options.direction seq = '' for e in [x.range for x in self.exons]: seq += str(ref[e.chr][e.st...
def get_junctions_string(self): """Get a string representation of the junctions. This is almost identical to a previous function. :return: string representation of junction :rtype: string """ self._initialize() return ';'.join([x.get_range_string() for x in self.junctions])
def junction_overlap(self,tx,tolerance=0): """Calculate the junction overlap between two transcripts :param tx: Other transcript :type tx: Transcript :param tolerance: how close to consider two junctions as overlapped (default=0) :type tolerance: int :return: Junction Overlap Report :rtype: Transcript.JunctionOverlap "...
def smooth_gaps(self,min_intron): """any gaps smaller than min_intron are joined, andreturns a new mapping with gaps smoothed :param min_intron: the smallest an intron can be, smaller gaps will be sealed :type min_intron: int :return: a mapping with small gaps closed :rtype: MappingGeneric """ rngs = [self._rngs[0].cop...
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() if name in CELESTIAL_TIME_TYPES: namespace = 'time' domain = 'Celestial Time Systems' time_name = CELESTIAL_TIME_TYPES[name] elif name in EARTH_TIME_TYPES: namespace = ...
def supports_coordinate_type(self, coordinate_type=None): """Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``COORDINATE`` raise: NullArgument - ``c...
def supports_currency_type(self, currency_type=None): """Tests if the given currency type is supported. arg: currency_type (osid.type.Type): a currency Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``CURRENCY`` raise: NullArgument - ``currency_type...
def supports_calendar_type(self, calendar_type=None): """Tests if the given calendar type is supported. arg: calendar_type (osid.type.Type): a calendar Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``DATETIME`` or ``DURATION`` raise: NullArgument -...
def supports_time_type(self, time_type=None): """Tests if the given time type is supported. arg: time_type (osid.type.Type): a time Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``DATETIME, DURATION,`` or ``TIME`` raise: NullArgument - ``time_type`...
def supports_heading_type(self, heading_type=None): """Tests if the given heading type is supported. arg: heading_type (osid.type.Type): a heading Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``HEADING`` raise: NullArgument - ``heading_type`` is `...
def supports_object_type(self, object_type=None): """Tests if the given object type is supported. arg: object_type (osid.type.Type): an object Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not an ``OBJECT`` raise: NullArgument - ``object_type`` is ``null...
def supports_spatial_unit_record_type(self, spatial_unit_record_type=None): """Tests if the given spatial unit record type is supported. arg: spatial_unit_record_type (osid.type.Type): a spatial unit record Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is n...
def supports_string_match_type(self, string_match_type=None): """Tests if the given string match type is supported. arg: string_match_type (osid.type.Type): a string match type return: (boolean) - ``true`` if the given string match type Is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``STRING`` ...
def supports_version_type(self, version_type=None): """Tests if the given version type is supported. arg: version_type (osid.type.Type): a version Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``VERSION`` raise: NullArgument - ``version_type`` is `...
def aggregate_registry_timers(): """Returns a list of aggregate timing information for registered timers. Each element is a 3-tuple of - timer description - aggregate elapsed time - number of calls The list is sorted by the first start time of each aggregate timer. """ import itertools timers = sorted(shared_registry.v...
def read_sbml(filename): """ Read the model from a SBML file. :param filename: SBML filename to read the model from :return: A tuple, consisting of :class:`~means.core.model.Model` instance, set of parameter values, and set of initial conditions variables. """ import libsbml if not os.path.exists(filename): raise IOErr...