Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSClean: support relative input and output paths #613

Open
anawas opened this issue Aug 21, 2024 · 5 comments
Open

WSClean: support relative input and output paths #613

anawas opened this issue Aug 21, 2024 · 5 comments
Assignees
Labels
bug Something isn't working prio-med Medium priority

Comments

@anawas
Copy link
Collaborator

anawas commented Aug 21, 2024

Summary

If I try to process an existing measurement set with WscleanImageCleaner then Karabo crashes with th error:

subprocess.CalledProcessError: Command 'cd /tmp/karabo-STM-andreas-4S0i7QquzI/WSClean-cleaned-O3U9epMOTu && OPENBLAS_NUM_THREADS=1 wsclean -size 4096 4096 -scale 0.00028647889756541165deg -niter 50000 -mgain 0.8 -auto-threshold 3 measurements.MS' returned non-zero exit status 255.

Steps to reporduce

Assume there is a measurement set measurements.MS from another Karabo workflow. The folder is in my working directory. When I clean the image using the follwing code, the above mentioned error appears:

# Set image property
imaging_npixel = 4096
imaging_cellsize = 5e-6

vis = Visibility(
    ms_file_path="measurements.MS",
)

cleaned_image = WscleanImageCleaner(
    WscleanImageCleanerConfig(
        imaging_npixel=imaging_npixel,
        imaging_cellsize=imaging_cellsize,
    )
)

cleaned_image.create_cleaned_image(
    ms_file_path=vis.ms_file_path,
    output_fits_path="output"
)

# Result
subprocess.CalledProcessError: Command 'cd /tmp/karabo-STM-andreas-4S0i7QquzI/WSClean-cleaned-O3U9epMOTu && OPENBLAS_NUM_THREADS=1 wsclean -size 4096 4096 -scale 0.00028647889756541165deg -niter 50000 -mgain 0.8 -auto-threshold 3 measurements.MS' returned non-zero exit status 255.

Expected result

I want to process dirty images no matter where they are located. Thus, the code above should output the result of the WSClean algorithm in the folder output. This are 5 FITS file.

@anawas anawas added bug Something isn't working prio-med Medium priority labels Aug 21, 2024
@anawas anawas self-assigned this Aug 21, 2024
@anawas
Copy link
Collaborator Author

anawas commented Aug 21, 2024

Workaround

Don't use Karabo. Execute wsclean from command line with

OPENBLAS_NUM_THREADS=1 wsclean -size 4096 4096 -scale 0.00028647889756541165deg -niter 50000 -mgain 0.8 -auto-threshold 3 measurements.MS

@mpluess
Copy link
Member

mpluess commented Aug 26, 2024

Currently, the ms_file_path needs to be an absolute path for WSClean because we need to do a cd due to the way WSClean works (outputs file to current working dir). I see two options: specifically add support for relative paths or document that an absolute path is expected. Which one do you prefer? Probably option 1?
Also, note that output_fits_path expects the path to the FITS file, e.g. /tmp/test.fits, not an output directory, and that currently, it needs to be an absolute path as well to do what you expect it to do.

@anawas
Copy link
Collaborator Author

anawas commented Aug 26, 2024

Yes, I prefer your option 1 (use relative path).

Also, note that output_fits_path expects the path to the FITS file, e.g. /tmp/test.fits, not an output directory, and that currently, it needs to be an absolute path as well to do what you expect it to do.

This I didn' know. But when I use all your suggestions then it works without an error. We may need to improve the documentation.

@mpluess
Copy link
Member

mpluess commented Aug 28, 2024

I could see the following TODOs then:

  • Support relative input paths for WscleanDirtyImager and WscleanImageCleaner
  • Support relative output paths for WscleanDirtyImager and WscleanImageCleaner
  • Make output_fits_path documentation more clear (expects a path to a file, not a directory)

@mpluess mpluess changed the title WscleanImageCleaner doesn't work with local files WSClean: support relative input and output paths Aug 28, 2024
@anawas
Copy link
Collaborator Author

anawas commented Aug 28, 2024

Looks like a plan! As it is assigned to me I'll take care of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working prio-med Medium priority
Projects
None yet
Development

No branches or pull requests

2 participants