helper module
Define helper function to load CST data.
- get_id(folderpath)[source]
Get the ID of the simulation stored in
folderpath.- Parameters:
folderpath (Path) – A
mmdd-xxxxxxxfolder.- Return type:
- mmdd_xxxxxxx_folder_to_dict(folderpath, delimiter='\\t')[source]
Put all results from a CST
mmdd-xxxxxxxfolder to a dict.The expected structure should look like:
mmdd-xxxxxxx ├── 'Adimensional e.txt' ├── 'Adimensional h.txt' ├── 'E_acc in MV per m.txt' ├── Parameters.txt ├── 'ParticleInfo [PIC]' │ ├── 'Emitted Secondaries.txt' │ └── 'Particle vs. Time.txt' ├── 'TD Number of mesh cells.txt' └── 'TD Total solver time.txt'
Corresponding output will look like:
dic = { 'Adimensional e': 4.2, 'Adimensional h': 2.0, 'E_acc in MV per m': 4.9, 'Parameters': {'f': 1e9, 'Period': '1 / f'}, 'Emitted Secondaries': np.array([0, 2, 3]), 'Particle vs. Time': np.array([100, 102, 105]), 'TD Number of mesh cells': 4.2, 'TD Total solver time': 4.2, }
Note
We skip hidden files, as well as all files in a folder containing the keyword
"3d".- Parameters:
folderpath (Path) – Path to a
mmdd-xxxxxxxfolder, holding the results of a single simulation among a parametric simulation export.delimiter (str, optional) – Delimiter between two columns. The default is a tab character.
- Returns:
dic – Holds the data of the folder. The keys are the name of the files. It will look like:
- Return type: