Commit 6fcda20a authored by Roland Haas's avatar Roland Haas

POWER: make usable as python module

parent 7b20453a
......@@ -371,21 +371,22 @@ def get_angular_momentum(python_strain):
#-----Main-----#
#Initialize simulation data
if(len(sys.argv) < 2):
if __name__ == "__main__":
#Initialize simulation data
if(len(sys.argv) < 2):
print("Pass in the number n of the n innermost detector radii to be used in the extrapolation (optional, default=all) and the simulation folders (e.g., ./power.py 6 ./simulations/J0040_N40 /path/to/my_simulation_folder).")
sys.exit()
elif(os.path.isdir(sys.argv[1])):
elif(os.path.isdir(sys.argv[1])):
radiiUsedForExtrapolation = 7 #use the first n radii available
paths = sys.argv[1:]
elif(not os.path.isdir(sys.argv[1])):
elif(not os.path.isdir(sys.argv[1])):
radiiUsedForExtrapolation = int(sys.argv[1]) #use the first n radii available
if(radiiUsedForExtrapolation < 1 or radiiUsedForExtrapolation > 7):
print("Invalid specified radii number")
sys.exit()
paths = sys.argv[2:]
for sim_path in paths:
for sim_path in paths:
main_dir = sim_path
sim = sim_path.split("/")[-1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment