Skip to content

Conversation

@Shrishagk
Copy link

@Shrishagk Shrishagk commented Jan 26, 2026

Overview

This PR improves the robustness of the training pipeline by addressing path resolution issues and preventing null-pointer errors during the PSF kernel setup in Grid_based_strong_lensing_for_unsupervised_super_resolution_Anirudh_Shankar/data.py and Grid_based_strong_lensing_for_unsupervised_super_resolution_Anirudh_Shankar/train.py

Changes

1.Path Portability:

Introduced script_dir using os.path.dirname(os.path.abspath(file)).

Defined grid_dir to explicitly point to the grid_matrices folder.

Updated all torch.load calls to use os.path.join(), ensuring the script can find its dependencies regardless of the working directory.

2.Argparse Improvements:

Added default=0.1 to the --resolution argument. This ensures that the physical lensing calculations have a valid numerical input even if the user does not manually specify the resolution.

3.Updated data.py:

To use os.path.join for dataset indexing. This ensures robust path construction regardless of whether the input directory string contains trailing slashes and improves cross-platform compatibility.

Impact

These changes make the repository much easier to use for new contributors, as the "out-of-the-box" execution of train.py no longer requires manual file moving or specific terminal positioning.

Testing

Verified by running: python Grid_based_strong_lensing_for_unsupervised_super_resolution_Anirudh_Shankar/train.py from the repository root. The script now correctly identifies the matrices and initializes the PSF kernel without errors.

@Shrishagk Shrishagk changed the title Fix: Implement path portability and add default resolution to Grid_based_strong_lensing_for_unsupervised_super_resolution_Anirudh_Shankar/train.py and /data.py Fix: Implement path portability and add default resolution to train.py and data.py Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant