Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop add datafiles repo #101

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions transistordatabase/database_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DatabaseManager:

module_manufacturers_file_path: str
housing_types_file_path: str

def __init__(self, housing_types_file_path: str = None, module_manufacturers_file_path: str = None):
self.operation_mode = None
self.tdb_directory = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -67,15 +67,13 @@ def set_operation_mode_json(self, json_folder_path: str = os.path.join(os.path.d
if self.operation_mode is not None:
raise Exception("DatabaseManager operation mode can only be set once.")
self.operation_mode = OperationMode.JSON

if not os.path.isdir(json_folder_path):
os.makedirs(json_folder_path)
self.json_folder = json_folder_path
index_response = requests.get(index_url)
print(index_response)
if not index_response.ok:
raise Exception(f"Index file was not found. URL: {index_url}")

for transistor_url in index_response.iter_lines():
transistor_response = requests.get(transistor_url)
print(transistor_url)
Expand All @@ -89,7 +87,6 @@ def set_operation_mode_json(self, json_folder_path: str = os.path.join(os.path.d
else:
transistor = self.convert_dict_to_transistor_object(transistor_response.json())
self.save_transistor(transistor, True)

else:
self.json_folder = json_folder_path

Expand Down
3 changes: 1 addition & 2 deletions transistordatabase/transistor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ def plot_curves(self, time_array, vds_values, ids_values, buffer_req: bool = Fal
plot_ids.tick_params(axis='y', labelcolor=color)
plt.tight_layout()
plt.grid(color='green', linestyle='--', linewidth=0.5)
return get_img_raw_data_2(plt)
return get_img_raw_data(plt)

def export_datasheet(self, build_collection=False) -> str | None:
"""
Expand Down Expand Up @@ -1428,7 +1428,6 @@ def export_datasheet(self, build_collection=False) -> str | None:
elif (attr == 'c_oss_er' or attr == 'c_oss_tr') and getattr(self, attr) is not None: # to be modified for boundary case
pdf_data[attr.capitalize()] = getattr(self, attr).c_o
trans, diode, switch = attach_units(pdf_data, devices)
# print(trans)
img_path = os.path.join(os.path.dirname(__file__), 'images', 'lea-upb.png')
image_file_obj = open(img_path, "rb")
image_binary_bytes = image_file_obj.read()
Expand Down
Loading