How to create dataset using PyAEDT?
Best Answers
-
Start by importing
pyaedt
.import pyaedt
Start an Icepak session by inserting a new Icepak design
ipk = pyaedt.Icepak(project="create_datasets.aedt", design="new_design", version=2024.2, new_desktop=True)
Create design and project dataset names
design_dataset = "design_dataset" project_dataset = "project_dataset"
When using project dataset, a "$" sign must be added as prefix.
project_dataset_name = "$" + project_dataset
In this example, a dataset for temperature-dependent thermal conductivity is created. Temperature (x-axis) has units of
cel
and thermal conductivity (y-axis) has units ofW_per_Kelm
.temp = [0.28, 11.16, 22.03, 35.74, 50.87, 75.94, 100.54, 142.17, 159.20, 199.89, 225.93, 271.36, 300.70, 327.20] k = [179.62, 170.08, 159.27, 149.74, 138.29, 126.23, 114.17, 100.22, 93.24, 85.03, 79.97, 73.04, 67.99, 63.57]
To create a project dataset use the following code lines. The code checks if a dataset with same name is already present, if not, a new dataset is created.
if project_dataset_name not in ipk.project_datasets.keys(): ipk.create_dataset1d_project(project_dataset, x=temp, y=k, x_unit="cel", y_unit="W_per_Kelm")
To create a design dataset use the following code lines
if design_dataset not in ipk.design_datasets.keys(): ipk.create_dataset1d_design(design_dataset, x=temp, y=k, x_unit="cel", y_unit="W_per_Kelm")
Release AEDT session using the following command.
ipk.release_desktop(close_projects=True, close_desktop=True)
0 -
Start by importing
pyaedt
.import pyaedt
Start an Icepak session.
ipk = pyaedt.Icepak(project="create_datasets.aedt", design="new_design", version=2024.1, new_desktop=True)
Set design and project dataset names
design_dataset = "design_dataset" project_dataset = "project_dataset"
When using project dataset, a "$" sign must be added as prefix.
project_dataset_name = "$" + project_dataset
List of temperature (x-axis) with units of
cel
temp = [0.28, 11.16, 22.03, 35.74, 50.87, 75.94, 100.54, 142.17, 159.20, 199.89, 225.93, 271.36, 300.70, 327.20]
List of thermal conductivity (y-axis) with units of
W_per_Kelm
k = [179.62, 170.08, 159.27, 149.74, 138.29, 126.23, 114.17, 100.22, 93.24, 85.03, 79.97, 73.04, 67.99, 63.57]
Create a project dataset. The
if
condition is used to check if the dataset already exists, if not, then create a new dataset.if project_dataset_name not in ipk.project_datasets.keys(): ipk.create_dataset1d_project(project_dataset, x=temp, y=k, x_unit="cel", y_unit="W_per_Kelm")
Create a design dataset
if design_dataset not in ipk.design_datasets.keys(): ipk.create_dataset1d_design(design_dataset, x=temp, y=k, x_unit="cel", y_unit="W_per_Kelm")
Release AEDT desktop session
ipk.release_desktop(close_projects=True, close_desktop=True)
0