code
stringlengths
1
18.2k
def use_plenary_asset_composition_view(self): """Pass through to provider AssetCompositionSession.use_plenary_asset_composition_view""" self._object_views['asset_composition'] = PLENARY # self._get_provider_session('asset_composition_session') # To make sure the session is tracked for session in self._get_provider_sess...
def use_comparative_composition_view(self): """Pass through to provider CompositionLookupSession.use_comparative_composition_view""" self._object_views['composition'] = COMPARATIVE # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions...
def use_plenary_composition_view(self): """Pass through to provider CompositionLookupSession.use_plenary_composition_view""" self._object_views['composition'] = PLENARY # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: ses...
def use_active_composition_view(self): """Pass through to provider CompositionLookupSession.use_active_composition_view""" self._operable_views['composition'] = ACTIVE # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: sess...
def use_any_status_composition_view(self): """Pass through to provider CompositionLookupSession.use_any_status_composition_view""" self._operable_views['composition'] = ANY_STATUS # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(...
def use_sequestered_composition_view(self): """Pass through to provider CompositionLookupSession.use_sequestered_composition_view""" self._containable_views['composition'] = SEQUESTERED # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for session in self._get_provider_ses...
def use_unsequestered_composition_view(self): """Pass through to provider CompositionLookupSession.use_unsequestered_composition_view""" self._containable_views['composition'] = UNSEQUESTERED # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for session in self._get_provid...
def get_composition_form(self, *args, **kwargs): """Pass through to provider CompositionAdminSession.get_composition_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time will tell. if isinstance(args[-1]...
def save_composition(self, composition_form, *args, **kwargs): """Pass through to provider CompositionAdminSession.update_composition""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if composition_form.is_for_update(): return self.update_composition(composition_form, *a...
def _run(self): '''The actor's main work loop''' while self._is_running: yield from self._task() # Signal that the loop has finished. self._run_complete.set_result(True)
def connect(self): """ Todo connect """ self.transport = Transport(self.token, on_connect=self.on_connect, on_message=self.on_message)
def on_connect(self, user): """ Todo connect """ self.user = user self.logger.info("connected as %s", user) if not isinstance(self.con_connect, type(None)): self.con_connect(user)
def on_message(self, data): """ Todo connect """ if self.user.id != data.author.id: self.logger.info("Message from %s: %s", data.author, data.content) if not isinstance(self.con_message, type(None)): self.logger.debug(type(self.con_message)) self.con_message(data)
def send_message(self, user=None, message=None,channel=None): """ Todo connect """ self.transport.send_message(user=user, message=message, channel=channel)
def _init_map(self): """stub""" self.my_osid_object_form._my_map['learningObjectiveId'] = \ str(self._learning_objective_id_metadata['default_id_values'][0]) self.my_osid_object_form._my_map['minimumProficiency'] = \ str(self._minimum_proficiency_metadata['default_id_values'][0])
def _init_metadata(self): """stub""" self._learning_objective_id_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'learning_objective_id'), 'element_label': 'Learning Objective Id', 'instructions': 'accepts a valid OSID Id string', 'required': False, 'read_only': F...
def _update_asset_content_filename_on_disk_to_match_id(self, ac): """Because we want the asset content filename to match the ac.ident, here we manipulate the saved file on disk after creating the asset content""" def has_secondary_storage(): return 'secondary_data_store_path' in self._config_map datastore_path = '' sec...
def _update_asset_content_url_to_match_id(self, ac): """update the ac URL value to match the ident""" mgr = self._provider_session._get_provider_manager('REPOSITORY') aas = mgr.get_asset_admin_session_for_repository(self._provider_session._catalog_id, proxy=self._provider_session._proxy) form = aas.get_asset_content_fo...
def delete_asset_content(self, asset_content_id=None): """Deletes content from an ``Asset``. arg: asset_content_id (osid.id.Id): the ``Id`` of the ``AssetContent`` raise: NotFound - ``asset_content_id`` is not found raise: NullArgument - ``asset_content_id`` is ``null`` raise: OperationFailed - unable to complete reque...
def _init_map(self): """stub""" super(edXNumericResponseQuestionFormRecord, self)._init_map() QuestionTextFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) self.my_osid_object_form._my_map['text']['text'] = ''
def _init_metadata(self): """stub""" super(edXNumericResponseQuestionFormRecord, self)._init_metadata() QuestionTextFormRecord._init_metadata(self) QuestionFilesFormRecord._init_metadata(self)
def generate_net(df,tf_idf,dump_path=None): '''Generate WordNetwork dict of Word() instance, and dump as a file if asked to. @Args: -- df : IDF value generated by find_tf_idf() tf_idf : TF-IDF value generated by find_tf_idf() dump_path : file_path where to dump network entities, standart format is '.wrnt' (default=None...
in tf_idf: for word in docs.keys(): word_net[word].addtofrwrd_links(set(docs.keys())) print(TAG, 'word filled with their relative words(network generated)... ',datetime.now()-start_t) # Dump the generated lists if dump_path is given. if dump_path: start_t = datetime.now() __words = {} __network = [] i=0 # creating word...
def retrieve_net(wrnt_path): '''Rerieves a dumped Network and generates WordNet instance. @Args: -- wrnt_path : file_path to the '.wrnt' network dumped file. @returns: -- word_net : dict of Word() entities generated from the input file. ''' # Exception Handling of wrong format. if wrnt_path[-4:] != __WRNT_FORMAT: raise...
def return_net(word,word_net,depth=1): '''Creates a list of unique words that are at a provided depth from root word. @Args: -- word : root word from which the linked words should be returned. word_net : word network (dictionary of word instances)to be refered in this process. depth : depth to which this process must t...
def load_config(self, name=None, path=None, home=False, ext='ini'): """Return the full path to a configuration file. This will look for configuration files in the ``full_path``, in the users home folder, or in a config directory in "/etc". If you set `home=True`, the system will look for a "hidden" configuration file i...
def _find_config(self, config_file): """This method will check if the configuration file "exist" If it does NOT then the method will bail calling an IOError. :param config_file: ``str`` :return: ``str`` """ msg = ('Configuration file [ %s ] was not found.' % self.filename) self.log.fatal(msg) raise IOError(msg)
def check_perms(self, perms='0600,0400'): """Check and enforce the permissions of the config file. Enforce permission on a provided configuration file. This will check and see if the permission are set based on the permission octet as set in the ``perms`` value. ``perms`` is a comma separated list of acceptable perms i...
def config_args(self, section='default'): """Loop through the configuration file and set all of our values. Note: that anything can be set as a "section" in the argument file. If a section does not exist an empty dict will be returned. :param section: ``str`` :return: ``dict`` """ if sys.version_info >= (2, 7, 0): pars...
def get_asset_content_lookup_session(self): """Pass through to provider get_asset_content_lookup_session""" return getattr(sessions, 'AssetContentLookupSession')( provider_session=self._provider_manager.get_asset_content_lookup_session(), authz_session=self._authz_session)
def get_asset_content_lookup_session_for_repository(self, repository_id): """Pass through to provider get_asset_content_lookup_session_for_repository""" return getattr(sessions, 'AssetContentLookupSession')( provider_session=self._provider_manager.get_asset_content_lookup_session_for_repository(repository_id), authz_se...
def get_asset_content_lookup_session(self, proxy): """Pass through to provider get_asset_content_lookup_session""" return getattr(sessions, 'AssetContentLookupSession')( provider_session=self._provider_manager.get_asset_content_lookup_session(proxy), authz_session=self._get_authz_session(), proxy=proxy)
def start_range(self): """Similar to the junction range but don't need to check for leftmost or rightmost""" if len(self._exons) == 0: return None return GenomicRange(self._exons[0].chr, min([x.start for x in self._exons]),# must be part of junction max([x.start for x in self._exons]))
def end_range(self): """Similar to the junction range but don't need to check for leftmost or rightmost""" if len(self._exons) == 0: return None return GenomicRange(self._exons[0].chr, min([x.end for x in self._exons]), max([x.end for x in self._exons]))
def _rngs(self): """This is where we should also enforce evidence requirements""" outputs = [] if len(self._exon_groups)==1: return [self._exon_groups.consensus('single')] z = 0 #output count begin = 0 meeting_criteria = [i for i in range(0,len(self._exon_groups)) if len(self._exon_groups) >= self._evidence] if len(mee...
def add_transcripts(self,txs): """We traverse through the other transcripts and try to add to these groups """ passed = [] for tx2 in txs: for tx1 in self._initial: jov = tx1.junction_overlap(tx2,self._tolerance) sub = jov.is_subset() if sub == 1 or sub == 2: passed.append(tx2) break if len(passed) == 0: sys.stderr.wri...
def add_transcript(self,tx): """add a single transcript""" candidates = tx.junctions targets = self.junctions matches = [] for i in range(0,len(targets)): for j in range(0,len(candidates)): if targets[i].overlaps(candidates[j],self._tolerance): matches.append([i,j]) if len(matches) != len(candidates): return if len(mat...
def parse(self,tolerance=0,downsample=None,evidence=2,use_gene_names=False): """Divide out the transcripts. allow junction tolerance if wanted""" g = Graph() nodes = [Node(x) for x in self._transcripts] for n in nodes: g.add_node(n) for i in range(0,len(nodes)): for j in range(0,len(nodes)): if i == j: continue jov = n...
def read_entry(self): """As long as entires overlap keep putting them together in a list that is the payload for a range that describes the bounds of the list :return: range with payload list of elements :rtype: GenomicRange """ if not self._current_range: return None output = None while True: try: e = self._stream.nex...
def get_start_stops(transcript_sequence, start_codons=None, stop_codons=None): """Return start and stop positions for all frames in the given transcript. """ transcript_sequence = transcript_sequence.upper() # for comparison with codons below if not start_codons: start_codons = ['ATG'] if not stop_codons: stop_codons =...
return seq_frames
def get_rna_counts(rna_file, transcript_name): """Get coverage for a given RNA BAM file, return read counts. """ # check if the RNA file exists if not os.path.exists(rna_file): msg = 'RNA-Seq BAM file "{}" does not exist'.format(rna_file) logging.error(msg) raise OSError(msg) rna_counts = {} cov_file = tempfile.NamedTe...
def set_axis_color(axis, color, alpha=None): """Sets the spine color of all sides of an axis (top, right, bottom, left).""" for side in ('top', 'right', 'bottom', 'left'): spine = axis.spines[side] spine.set_color(color) if alpha is not None: spine.set_alpha(alpha)
def get_color_palette(scheme): """Return colors for a given scheme. Default colors are returned for an item if undefined in scheme. """ color_schemes = { 'default': { 'frames': ['tomato', 'limegreen', 'deepskyblue'], 'background': '#ffffff', 'color': '#616161', 'ticks': '#757575', 'start': '#ffffff', 'stop': '#909090',...
def plot_profile(ribo_counts, transcript_name, transcript_length, start_stops, read_lengths=None, read_offsets=None, rna_counts=None, color_scheme='default', html_file='index.html', output_path='output'): """Plot read counts (in all 3 frames) and RNA coverage if provided for a single transcript. """ colors = get_color_...
in (1, 2, 3): if v[fr] > 0: frame_counts[fr][k] = v[fr] break cnts = [] [cnts.extend(item.values()) for item in frame_counts.values()] y_max = float(max(cnts) * 1.25) ax2.set_ylim(0.0, y_max) ax2.set_zorder(2) ax2.patch.set_facecolor('none') for frame in (1, 2, 3): color = colors['frames'][frame - 1] x_vals = frame_cou...
0.1, "Frames", size=5, ha='center', va='center', color=colors['color'], fontdict={'weight': 'bold'}) ax7.text(0.17, 0.1, "1", size=5, ha="center", va="center", color='white', bbox=dict(boxstyle="square", color=colors['frames'][0])) ax7.text(0.19, 0.1, "2", size=5, ha="center", va="center", color='white', bbox=dict(boxs...
[(item, 1) for item in start_stops[frame]['starts']] stops = [(item, 1) for item in start_stops[frame]['stops']] start_colors = [colors['start'] for item in starts] axis.broken_barh(starts, (0.11, 0.2), facecolors=start_colors, edgecolors=start_colors, label='start', zorder=5) stop_colors = [colors['stop'] for item in ...
def create_parser(): """Argument parser. """ parser = argparse.ArgumentParser( prog='riboplot.py', description='Plot and output read counts for a single transcript') required = parser.add_argument_group('required arguments') required.add_argument('-b', '--ribo_file', help='Ribo-Seq alignment file in BAM format', requir...
help='Color scheme to use (default: %(default)s)', choices=['default', 'colorbrewer', 'rgb', 'greyorfs'], default='default') parser.add_argument('-m', '--html_file', help='Output file for results (HTML)', default='riboplot.html') parser.add_argument('-o', '--output_path', help='Files are saved in this directory', defau...
def main(args): """Main program""" (ribo_file, rna_file, transcript_name, transcriptome_fasta, read_lengths, read_offsets, output_path, html_file) = ( args.ribo_file, args.rna_file, args.transcript_name, args.transcriptome_fasta, args.read_lengths, args.read_offsets, args.output_path, args.html_file) # error messages (...
bam_fileobj: ribo_counts, total_reads = ribocore.get_ribo_counts( ribo_fileobj=bam_fileobj, transcript_name=transcript_name, read_lengths=read_lengths, read_offsets=read_offsets) if not ribo_counts: msg = ('No RiboSeq read counts for transcript {}. No plot will be ' 'generated!'.format(transcript_name)) log.error(msg) ...
transcript_sequence[pos - 1], ribo_counts[pos][1], ribo_counts[pos][2], ribo_counts[pos][3])) else: f.write('{0},{1},{2},{3},{4}\n'.format(pos, transcript_sequence[pos - 1], 0, 0, 0)) log.info('Generating RiboPlot...') plot_profile(ribo_counts, transcript_name, transcript_length, codon_positions, read_lengths, read_off...
def _init_metadata(self): """stub""" self._choices_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'choices'), 'element_label': 'Choices', 'instructions': 'Enter as many choices as you wish', 'required': True, 'read_only': False, 'linked': False, 'array': True, 'd...
def clear_choice(self, choice): """stub""" if len(self.my_osid_object_form._my_map['choices']) == 0: raise IllegalState('there are currently no choices defined for this question') if (len(self.my_osid_object_form._my_map['choices']) == 1 and choice in self.my_osid_object_form._my_map['choices']): raise IllegalState() s...
def _init_metadata(self): """stub""" super(BaseMultiChoiceTextQuestionFormRecord, self)._init_metadata() self._choice_text_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'choice_text'), 'element_label': 'choice text', 'instructions': 'enter the text for this choi...
def add_choice(self, text, name='', identifier=None): """stub""" if not utilities.is_string(text): raise InvalidArgument('text is not a string') choice_display_text = self._choice_text_metadata['default_string_values'][0] choice_display_text['text'] = text if identifier is None: identifier = str(ObjectId()) choice = { ...
def _init_metadata(self): """stub""" super(BaseMultiChoiceFileQuestionFormRecord, self)._init_metadata() self._choice_file_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'choice-file'), 'element_label': 'Choice File', 'instructions': 'accepts an Asset Id', 'requi...
def add_choice(self, asset_id, name='', identifier=None): """stub""" if identifier is None: identifier = str(ObjectId()) self.my_osid_object_form._my_map['choices'].append({ 'id': identifier, 'assetId': str(asset_id), 'name': name }) return identifier
def _init_map(self): """stub""" QuestionTextAndFilesMixin._init_map(self) BaseMultiChoiceTextQuestionFormRecord._init_map(self) super(MultiChoiceTextAndFilesQuestionFormRecord, self)._init_map()
def _init_metadata(self): """stub""" QuestionTextAndFilesMixin._init_metadata(self) BaseMultiChoiceTextQuestionFormRecord._init_metadata(self) super(MultiChoiceTextAndFilesQuestionFormRecord, self)._init_metadata()
def _init_metadata(self): """stub""" self._choice_ids_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'choice_ids'), 'element_label': 'response set', 'instructions': 'submit correct choice for answer', 'required': False, 'read_only': False, 'linked': False, 'array...
def clear_choice_ids(self): """stub""" if (self.get_choice_ids_metadata().is_read_only() or self.get_choice_ids_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['choiceIds'] = \ self._choice_ids_metadata['default_object_values'][0]
def _init_map(self): """stub""" MultiChoiceAnswerFormRecord._init_map(self) FilesAnswerFormRecord._init_map(self) FeedbackAnswerFormRecord._init_map(self) super(MultiChoiceFeedbackAndFilesAnswerFormRecord, self)._init_map()
def _init_metadata(self): """stub""" MultiChoiceAnswerFormRecord._init_metadata(self) FilesAnswerFormRecord._init_metadata(self) FeedbackAnswerFormRecord._init_metadata(self) super(MultiChoiceFeedbackAndFilesAnswerFormRecord, self)._init_metadata()
def get_choices(self): """stub""" # ideally would return a displayText object in text ... except for legacy # use cases like OEA, it expects a text string. choices = [] # for current_choice in self.my_osid_object.object_map['choices']: for current_choice in self.my_osid_object._my_map['choices']: filtered_choice = { 'i...
def _init_map(self): """stub""" super(MultiLanguageMultipleChoiceQuestionFormRecord, self)._init_map() self.my_osid_object_form._my_map['choices'] = \ self._choices_metadata['default_object_values'][0]
def _init_metadata(self): """stub""" super(MultiLanguageMultipleChoiceQuestionFormRecord, self)._init_metadata() self._choices_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'choices'), 'element_label': 'choices', 'instructions': 'Enter as many text choices as yo...
def add_choice(self, choice, name='', identifier=None): """stub""" if not isinstance(choice, DisplayText): raise InvalidArgument('choice is not a displayText object') if identifier is None: identifier = str(ObjectId()) current_identifiers = [c['id'] for c in self.my_osid_object_form._my_map['choices']] if identifier no...
def clear_choices(self): """stub""" if self.get_choices_metadata().is_read_only(): raise NoAccess() self.my_osid_object_form._my_map['choices'] = \ self._choices_metadata['default_object_values'][0]
def clear_choice_texts(self, choice_id): """stub""" if self.get_choices_metadata().is_read_only(): raise NoAccess() updated_choices = [] for current_choice in self.my_osid_object_form._my_map['choices']: if current_choice['id'] != choice_id: updated_choices.append(current_choice) else: updated_choices.append({ 'id': cu...
def read_csv(filename): """Reads a CSV file containing a tabular description of a transition function, as found in Sipser. Major difference: instead of multiple header rows, only a single header row whose entries might be tuples. """ with open(filename) as file: table = list(csv.reader(file)) m = from_table(table) retu...
def read_excel(filename, sheet=None): """Reads an Excel file containing a tabular description of a transition function, as found in Sipser. Major difference: instead of multiple header rows, only a single header row whose entries might be tuples. """ from openpyxl import load_workbook wb = load_workbook(filename) if sh...
def data(place): """get forecast data.""" lat, lon = place url = "https://api.forecast.io/forecast/%s/%s,%s?solar" % (APIKEY, lat, lon) w_data = json.loads(urllib2.urlopen(url).read()) return w_data
def mangle(data_point): """mangle data into expected format.""" temp_dict = {} temp_dict.update(data_point) temp_dict['utc_datetime'] = \ datetime.datetime.utcfromtimestamp(temp_dict['time']) if 'solar' in data_point: temp_dict['GHI (W/m^2)'] = data_point['solar']['ghi'] temp_dict['DNI (W/m^2)'] = data_point['solar']['...
def hourly(place): """return data as list of dicts with all data filled in.""" # time in utc? lat, lon = place url = "https://api.forecast.io/forecast/%s/%s,%s?solar" % (APIKEY, lat, lon) w_data = json.loads(urllib2.urlopen(url).read()) hourly_data = w_data['hourly']['data'] mangled = [] for i in hourly_data: mangled.a...
def current(place): """return data as list of dicts with all data filled in.""" lat, lon = place url = "https://api.forecast.io/forecast/%s/%s,%s?solar" % (APIKEY, lat, lon) w_data = json.loads(urllib2.urlopen(url).read()) currently = w_data['currently'] return mangle(currently)
def read_stack(stack, plyt=None, laminaprop=None, rho=None, plyts=None, laminaprops=None, rhos=None, offset=0., calc_scf=True): """Read a laminate stacking sequence data. An ``Laminate`` object is returned based on the inputs given. Parameters ---------- stack : list Angles of the stacking sequence in degrees. plyt : f...
optional Offset along the normal axis about the mid-surface, which influences the laminate properties. calc_scf : bool, optional If True, use :method:`.Laminate.calc_scf` to compute shear correction factors, otherwise the default value of 5/6 is used Notes ----- ``plyt`` or ``plyts`` must be supplied ``laminaprop`` or ...
for i in stack] if rhos is None: rhos = [rho for i in stack] lam.plies = [] for plyt, laminaprop, theta, rho in zip(plyts, laminaprops, stack, rhos): laminaprop = laminaprop ply = Lamina() ply.theta = float(theta) ply.h = plyt ply.matobj = read_laminaprop(laminaprop, rho) lam.plies.append(ply) lam.rebuild() lam.calc_co...
def read_lamination_parameters(thickness, laminaprop, rho, xiA1, xiA2, xiA3, xiA4, xiB1, xiB2, xiB3, xiB4, xiD1, xiD2, xiD3, xiD4, xiE1, xiE2, xiE3, xiE4): r"""Calculates a laminate based on the lamination parameters. The lamination parameters: `\xi_{A1} \cdots \xi_{A4}`, `\xi_{B1} \cdots \xi_{B4}`, `\xi_{C1} \cdots \x...
dtype=np.float64) lam.xiB = np.array([0, xiB1, xiB2, xiB3, xiB4], dtype=np.float64) lam.xiD = np.array([1, xiD1, xiD2, xiD3, xiD4], dtype=np.float64) lam.xiE = np.array([1, xiE1, xiE2, xiE3, xiE4], dtype=np.float64) lam.calc_ABDE_from_lamination_parameters() return lam
def calc_scf(self): """Calculate improved shear correction factors Reference: Vlachoutsis, S. "Shear correction factors for plates and shells", Int. Journal for Numerical Methods in Engineering, Vol. 33, 1537-1552, 1992. http://onlinelibrary.wiley.com/doi/10.1002/nme.1620330712/full Using "one shear correction factor" ...
(ply.matobj.e2 * np.cos(np.deg2rad(ply.theta)) + ply.matobj.e1 * np.sin(np.deg2rad(ply.theta))) nu12 = (ply.matobj.nu12 * np.cos(np.deg2rad(ply.theta)) + ply.matobj.nu21 * np.sin(np.deg2rad(ply.theta))) nu21 = (ply.matobj.nu21 * np.cos(np.deg2rad(ply.theta)) + ply.matobj.nu12 * np.sin(np.deg2rad(ply.theta))) D1 += e1 /...
D2**2*(15*offset*z1**4 + 30*offset*z1**2*zbot*(2*offset - zbot) - 15*offset*z2**4 + 30*offset*z2**2*zbot*(-2*offset + zbot) - 3*z1**5 + 10*z1**3*(-2*offset**2 - 2*offset*zbot + zbot**2) - 15*z1*zbot**2*(4*offset**2 - 4*offset*zbot + zbot**2) + 3*z2**5 + 10*z2**3*(2*offset**2 + 2*offset*zbot - zbot**2) + 15*z2*zbot**2*(...
def calc_equivalent_modulus(self): """Calculates the equivalent laminate properties. The following attributes are calculated: e1, e2, g12, nu12, nu21 """ AI = np.matrix(self.ABD, dtype=np.float64).I a11, a12, a22, a33 = AI[0,0], AI[0,1], AI[1,1], AI[2,2] self.e1 = 1./(self.h*a11) self.e2 = 1./(self.h*a22) self.g12 = 1....
def calc_lamination_parameters(self): """Calculate the lamination parameters. The following attributes are calculated: xiA, xiB, xiD, xiE """ if len(self.plies) == 0: if self.xiA is None: raise ValueError('Laminate with 0 plies!') else: return xiA1, xiA2, xiA3, xiA4 = 0, 0, 0, 0 xiB1, xiB2, xiB3, xiB4 = 0, 0, 0, 0 xiD1...
lam_thick**3) * (hk**3 - hk_1**3) Efac = (1. / lam_thick) * (hk - hk_1) thetarad = np.deg2rad(ply.theta) cos2t = np.cos(2*thetarad) sin2t = np.sin(2*thetarad) cos4t = np.cos(4*thetarad) sin4t = np.sin(4*thetarad) xiA1 += Afac * cos2t xiA2 += Afac * sin2t xiA3 += Afac * cos4t xiA4 += Afac * sin4t xiB1 += Bfac * cos2t xi...
xiD1, xiD2, xiD3, xiD4], dtype=np.float64) self.xiE = np.array([1, xiE1, xiE2, xiE3, xiE4], dtype=np.float64)
def calc_ABDE_from_lamination_parameters(self): """Use the ABDE matrix based on lamination parameters. Given the lamination parameters ``xiA``, ``xiB``, ``xiC`` and ``xiD``, the ABD matrix is calculated. """ # dummies used to unpack vector results du1, du2, du3, du4, du5, du6 = 0, 0, 0, 0, 0, 0 # A matrix terms A11,A22...
[D16, D26, D66]], dtype=np.float64) # printing E acoordingly to Reddy definition for E44, E45 and E55 self.E = np.array([[E55, E45], [E45, E44]], dtype=np.float64) self.ABD = np.array([[A11, A12, A16, B11, B12, B16], [A12, A22, A26, B12, B22, B26], [A16, A26, A66, B16, B26, B66], [B11, B12, B16, D11, D12, D16], [B12, B...
0, 0, E55, E45], [0, 0, 0, 0, 0, 0, E45, E44]], dtype=np.float64)
def calc_constitutive_matrix(self): """Calculates the laminate constitutive matrix This is the commonly called ``ABD`` matrix with ``shape=(6, 6)`` when the classical laminated plate theory is used, or the ``ABDE`` matrix when the first-order shear deformation theory is used, containing the transverse shear terms. """ ...
axis=0) self.ABDE = np.zeros((8, 8), dtype=np.float64) self.ABDE[0:6, 0:6] = self.ABD self.ABDE[6:8, 6:8] = self.E
def force_balanced_LP(self): r"""Force balanced lamination parameters The lamination parameters `\xi_{A2}` and `\xi_{A4}` are set to null to force a balanced laminate. """ dummy, xiA1, xiA2, xiA3, xiA4 = self.xiA self.xiA = np.array([1, xiA1, 0, xiA3, 0], dtype=np.float64) self.calc_ABDE_from_lamination_parameters()
def force_orthotropic(self): r"""Force an orthotropic laminate The terms `A_{13}`, `A_{23}`, `A_{31}`, `A_{32}`, `B_{13}`, `B_{23}`, `B_{31}`, `B_{32}`, `D_{13}`, `D_{23}`, `D_{31}`, `D_{32}` are set to zero to force an orthotropic laminate. """ if self.offset != 0.: raise RuntimeError( 'Laminates with offset cannot be...
5] = 0. # B26 self.ABD[5, 1] = 0. # B62 self.ABD[3, 2] = 0. # B16 self.ABD[2, 3] = 0. # B61 self.ABD[4, 2] = 0. # B26 self.ABD[2, 4] = 0. # B62 self.ABD[3, 5] = 0. # D16 self.ABD[4, 5] = 0. # D26 self.ABD[5, 3] = 0. # D61 self.ABD[5, 4] = 0. # D62 self.ABDE[0, 2] = 0. # A16 self.ABDE[1, 2] = 0. # A26 self.ABDE[2, 0] = ...
0. # B62 self.ABDE[3, 5] = 0. # D16 self.ABDE[4, 5] = 0. # D26 self.ABDE[5, 3] = 0. # D61 self.ABDE[5, 4] = 0.
def force_symmetric(self): """Force a symmetric laminate The `B` terms of the constitutive matrix are set to zero. """ if self.offset != 0.: raise RuntimeError( 'Laminates with offset cannot be forced symmetric!') self.B = np.zeros((3,3)) self.ABD[0:3, 3:6] = 0 self.ABD[3:6, 0:3] = 0 self.ABDE[0:3, 3:6] = 0 self.ABDE[3...
def get_next_grade(self): """Gets the next ``Grade`` in this list. return: (osid.grading.Grade) - the next ``Grade`` in this list. The ``has_next()`` method should be used to test that a next ``Grade`` is available before calling this method. raise: IllegalState - no more elements available in this list raise: Operatio...