This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 01A. TO PLOT A SINGLE GRAPH AS OUTPUT - 2D (should prefer 01B) | |
| # | |
| import matplotlib.pyplot as plt | |
| # data creation | |
| x = list(i for i in range(5, 11)) | |
| print(f"x value: {x}") | |
| y1 = list(i ** 2 for i in range(5, 11)) | |
| print(f"y1 value: {y1}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 01. TO READ 2D ARRAY - SPACE DELIMITED | |
| # ref: https://www.datacamp.com/community/tutorials/python-numpy-tutorial#make | |
| # file: | |
| Value1 Value2 Value3 | |
| 0.1 0.2 0.3 | |
| 0.4 0.5 NA | |
| NA 0.8 0.9 | |
| 0.2 0.3 0.4 | |
| # code: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import pi | |
| def get_pi(): | |
| try: | |
| n = int(input("Enter decimal places: ")) | |
| if n < 17: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| inp_dir = r"C:\SUVOPAM_local\Dolwin5\02_Aba\slamming\und23" | |
| double_prec = False | |
| n_cpu = 16 | |
| searchInpFiles = False | |
| multi_job_names = ['x', 'y', 'z'] # if searchInpFiles = False | |
| if searchInpFiles: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''writes element id, node id and co-ordinates to a file in same directory as model db''' | |
| def exp(model_name, part_name): | |
| m = mdb.models[model_name] | |
| p = m.parts[part_name] | |
| el_set = p.allSets | |
| el_key_list = el_set.keys() | |
| mfile = open("el_node_db.txt", "w+") | |
| for x in range(len(el_key_list)): | |
| e = el_key_list[x] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model_name = "aba1" # enter model name | |
| part_name = "PART-1" # enter part name | |
| diagonal = [(272.190002,117.444252,543.400024), (272.339996,117.050499,543.400024)] # diagonal of searching volume | |
| tol = 1e-6 # default tolerance value for finding the nodes 1e-6 | |
| def node_dict_creator(model_name_, part_name_): | |
| '''returns node_dict which holds node label against its co-ordinates''' | |
| node_dict = {} | |
| m = mdb.models[model_name_] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model_name = "aba1" # enter model name | |
| part_name = "PART-1" # enter part name | |
| def exp(model_name_, part_name_): | |
| m = mdb.models[model_name_] | |
| f = m.rootAssembly.features | |
| f_dict = {} | |
| for i in f.keys(): | |
| try: | |
| redundant = f[i].xValue # to clean PART number key from selection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import regionToolset | |
| model_name = "aba1" # model name | |
| instance_name = "PART-1-1" | |
| def exp(model_name_, instance_name_): | |
| m = mdb.models[model_name_] | |
| a = m.rootAssembly | |
| ## MPC CONSTRAIN CREATION B/W RP AND COLLECTION OF NODES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from part import * | |
| from material import * | |
| from section import * | |
| from assembly import * | |
| from step import * | |
| from interaction import * | |
| from load import * | |
| from mesh import * | |
| from optimization import * | |
| from job import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import quandl, math | |
| quandl.ApiConfig.api_key = 'Ssn1muRqsyT5SBvP3wDm' | |
| df = quandl.get("WIKI/GOOGL") | |
| # print(df.head()) | |
| # print(df.shape) | |
| df = df[['Adj. Open', 'Adj. High', 'Adj. Low', 'Adj. Close', 'Adj. Volume']] | |
| df['HL_PCT'] = (df['Adj. High'] - df['Adj. Low']) / df['Adj. Close'] * 100.0 |
OlderNewer