changed all __main__ scripts to console_main() functions to be used as entry points
This commit is contained in:
parent
f487691e03
commit
00124bbdcc
8 changed files with 45 additions and 18 deletions
|
@ -36,8 +36,7 @@ def convert_snapshot_to_density(snapshot_path, output_path, N=None, corner=(0.0,
|
|||
print("Done.")
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def console_main():
|
||||
parser = argparse.ArgumentParser(description="Convert snapshot to density.")
|
||||
parser.add_argument(
|
||||
"-S",
|
||||
|
@ -76,4 +75,8 @@ if __name__ == "__main__":
|
|||
output_path=args.output,
|
||||
N=args.N,
|
||||
corner=args.corner,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
console_main()
|
|
@ -115,8 +115,7 @@ def field_to_field(
|
|||
print("Done.")
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def console_main():
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(description="Convert a field from one size to another.")
|
||||
parser.add_argument("-i","--input_file", type=str, help="Input field file")
|
||||
|
@ -128,4 +127,8 @@ if __name__ == "__main__":
|
|||
parser.add_argument("-BC","--boundary_conditions", type=int, default=1, help="Boundary conditions (1: periodic, 3: non-periodic)")
|
||||
args = parser.parse_args()
|
||||
|
||||
field_to_field(args.input_file, args.output_file, args.output_size, args.output_L, args.output_dpm, args.output_corner, args.boundary_conditions)
|
||||
field_to_field(args.input_file, args.output_file, args.output_size, args.output_L, args.output_dpm, args.output_corner, args.boundary_conditions)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
console_main()
|
|
@ -99,8 +99,7 @@ def gather_tiles(folder, tile_base, L, Np, N_TILES, buffer):
|
|||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def console_main():
|
||||
parser = argparse.ArgumentParser(description="Gather density from tiles.")
|
||||
parser.add_argument("-d","--folder", type=str, default="./", help="Folder containing the tiles")
|
||||
parser.add_argument("--tile_base", type=str, default="sCOLA_tile", help="Base name of the tiles")
|
||||
|
@ -121,4 +120,9 @@ if __name__ == "__main__":
|
|||
Np_tile = Np//N_TILES
|
||||
dpm = L/Np_tile
|
||||
|
||||
gather_tiles(folder, tile_base, L, Np, N_TILES, buffer)
|
||||
gather_tiles(folder, tile_base, L, Np, N_TILES, buffer)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
console_main()
|
|
@ -462,9 +462,7 @@ def scola_submit(directory,
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def console_main():
|
||||
parser = argparse.ArgumentParser(description="Submit slurm jobs for sCOLA tiles.")
|
||||
|
||||
parser.add_argument("-d", "--directory", type=str, default="./", help="Main directory where the output will be saved (if other dir and filenames are not specified).")
|
||||
|
@ -496,4 +494,9 @@ if __name__ == "__main__":
|
|||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
console_main()
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue