GOALS-survey / CAFE

Spectral decomposition that works for astronomical data
Other
12 stars 5 forks source link

CRETA. Aperture correction does not work and the check in creta.py need to rewrite #6

Open ThomasSYLai opened 1 year ago

ThomasSYLai commented 1 year ago

The following code needs a rewrite. If sel_cube == 'ch1-short' sel_cube would not be in ch1_SHORT due to the underscore and the capitalization.

files_sort = [] PSF_files_sort = [] for sel_cube in sel_cubes: if any(sel_cube in file for file in files): for file in files: if sel_cube in file: files_sort.append(file) else: print(file_sort) raise Exception('One or more cubes not in data directory. Make sure you point to the right path with the "data_path" command-line keyword')

            ipdb.set_trace()
            if aperture_correction or convolve:
                if any(sel_cube in str.lower(PSF_file) for PSF_file in PSF_files):
                    for PSF_file in PSF_files:
                        if sel_cube in str.lower(PSF_file): PSF_files_sort.append(PSF_file)
                else:
                    raise Exception('One or more cubes not in data directory')

Also, an error occur when setting aperture correction in the params file to True image

tdiazsantos commented 1 year ago

Regarding the underscore and capitalization, If I understand well what you mean, I'm afraid that's something we can't really accommodate since the user may provide cubes with arbitrary names in which "ch1" and "short" can be written and connected to each other in many ways. I will modify the documentation to say that the names provided in the cube list in the parameter file need to match or be a substring of the cube file names themselves.

Regarding the error in the aperture correction, I'm not sure what can be. I need to see the parameter file you used to make the extraction.