Fri 29 Nov 2024 04:30:50 PM CET
This commit is contained in:
		
							parent
							
								
									c91fefd376
								
							
						
					
					
						commit
						d651557353
					
				
							
								
								
									
										29
									
								
								src/main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/main.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | import json | ||||||
|  | import os | ||||||
|  | import sys | ||||||
|  | import numpy as np | ||||||
|  | # from SimNDT.run_setup.SimulationVideo import create_vector_field_video | ||||||
|  | from SimNDT.run_setup.runSimulator import openSim, runEngine #, saveVideo | ||||||
|  | 
 | ||||||
|  | def main(json_filepath): | ||||||
|  |   try: | ||||||
|  |     # Read the JSON file from the provided file path | ||||||
|  |     with open(json_filepath, "r") as f: | ||||||
|  |         sim_params = json.load(f) | ||||||
|  | 
 | ||||||
|  |     # Setup simulation environment with the provided parameters | ||||||
|  |     simPack = openSim(sim_params) | ||||||
|  | 
 | ||||||
|  |     # Run the simulation engine and save the results | ||||||
|  |     runEngine(simPack) | ||||||
|  | 
 | ||||||
|  |   except Exception as e: | ||||||
|  |     print(e) | ||||||
|  | 
 | ||||||
|  | if __name__ == "__main__": | ||||||
|  |     if len(sys.argv) != 2: | ||||||
|  |         print("Usage: python main.py <path_to_json_file>") | ||||||
|  |         sys.exit(1) | ||||||
|  | 
 | ||||||
|  |     json_filepath = sys.argv[1] | ||||||
|  |     main(json_filepath) | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user