Skip to content

Commit

Permalink
adding --distortion argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kai-polsterer committed Oct 27, 2023
1 parent 74d5d3f commit 658b8f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/hipster.py",
"args": "hips --config ${workspaceFolder}/experiments/illustris.yaml --checkpoint ${workspaceFolder}/Illustris128_128_E2026_S202700.ckpt --max_order 4 --hierarchy 8 --crop_size 256 --output_size 64 --output_folder /local_data/AIN/Data/HiPSter --title IllustrisV4",
"args": "hips --config ${workspaceFolder}/experiments/illustris.yaml --checkpoint ${workspaceFolder}/Illustris128_128_E2026_S202700.ckpt --max_order 4 --hierarchy 8 --crop_size 256 --output_size 64 --output_folder /local_data/AIN/Data/HiPSter --title IllustrisV4 --distortion",
"console": "integratedTerminal",
"justMyCode": true
},
Expand Down
9 changes: 5 additions & 4 deletions hipster.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Hipster():
model that projects images on a sphere.
"""

def __init__(self, output_folder, title, max_order=3, hierarchy=1, crop_size=64, output_size=128, distortion_correction=True):
def __init__(self, output_folder, title, max_order=3, hierarchy=1, crop_size=64, output_size=128, distortion_correction=False):
""" Initializes the hipster
Args:
Expand Down Expand Up @@ -449,7 +449,6 @@ def create_hips_tile(hipster, model, i, range_j):
print('.', end="", flush=True)

if __name__ == "__main__":
#multiprocessing.set_start_method('fork')
parser = argparse.ArgumentParser(description="Transform a model in a HiPS representation")
parser.add_argument("task", help="Execution task [hips, catalog, projection, all].")
parser.add_argument("--config", "-c", default="config.yaml",
Expand All @@ -468,6 +467,8 @@ def create_hips_tile(hipster, model, i, range_j):
help="Output of HiPS (default = './HiPSter').")
parser.add_argument("--title", default='IllustrisV2',
help="HiPS title (default = 'IllustrisV2').")
parser.add_argument("--distortion", action="store_true",
help="Enable distortion correction.")

args = parser.parse_args()
with open(args.config, "r", encoding="utf-8") as stream:
Expand All @@ -481,7 +482,6 @@ def create_hips_tile(hipster, model, i, range_j):
model_class = getattr(module, class_name)
model_init_args = config['model']['init_args']
myModel = model_class(**model_init_args)

checkpoint = torch.load(args.checkpoint)
myModel.load_state_dict(checkpoint["state_dict"])

Expand All @@ -497,7 +497,8 @@ def create_hips_tile(hipster, model, i, range_j):

myHipster = Hipster(args.output_folder, args.title,
max_order=args.max_order, hierarchy=args.hierarchy,
crop_size=args.crop_size, output_size=args.output_size)
crop_size=args.crop_size, output_size=args.output_size,
distortion_correction=args.distortion)

if (args.task == "hips" or args.task == "all"):
myHipster.generate_hips(myModel)
Expand Down

0 comments on commit 658b8f8

Please sign in to comment.