[skip sc][skip ci] using pathlib and reduced the number of args

This commit is contained in:
Vitesh Shah 2023-03-03 08:50:22 +01:00
parent f15d1da169
commit 12c39c0977
1 changed files with 6 additions and 8 deletions

View File

@ -2,6 +2,7 @@
import argparse import argparse
import os import os
from pathlib import Path
import h5py import h5py
import numpy as np import numpy as np
@ -51,23 +52,20 @@ class DAMASKtoDREAM3D():
There can be various different types of ways DAMASK data can be represented. There can be various different types of ways DAMASK data can be represented.
Therefore, there are multiple functions available for different purposes. Therefore, there are multiple functions available for different purposes.
""" """
def __init__(self,simulation_folder,job_file,geom_file,load_file): def __init__(self,job_file,geom_file,load_file):
""" """
Defining the common quantities for all the functions in this class. Defining the common quantities for all the functions in this class.
Parameters Parameters
---------- ----------
simulation_folder: str job_file: str or pathlib.Path
Path of the simulation folder. Full path of the DAMASK results file.
job_file: str
Name of the job file (DADF5 file).
geom_file : str geom_file : str
name of the geom file. name of the geom file.
load_file : load_file :
name of the load file. name of the load file.
""" """
self.simulation_folder = simulation_folder self.job_file = Path(job_file).expanduser().absolute()
self.job_file = job_file
self.geom_file = geom_file self.geom_file = geom_file
self.load_file = load_file self.load_file = load_file
@ -84,7 +82,7 @@ class DAMASKtoDREAM3D():
inc: int inc: int
increment of interest for DREAM3D processing. increment of interest for DREAM3D processing.
""" """
os.chdir(self.simulation_folder) os.chdir(self.job_file.parents[0])
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
#Build array of euler angles for each cell #Build array of euler angles for each cell
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------