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

fil.create_mask in example script not working #77

Open
mbhaswati opened this issue Aug 16, 2022 · 2 comments
Open

fil.create_mask in example script not working #77

mbhaswati opened this issue Aug 16, 2022 · 2 comments

Comments

@mbhaswati
Copy link

I am simply trying to reproduce the results of the example script in the FilFinder Tutorial and it gets stuck at:

fil.create_mask(verbose=True, border_masking=False, size_thresh=400 * u.pix**2, glob_thresh=0.0267)

The error is:

astropy.units.core.UnitConversionError: 'Unit("K")' is not a scaled version of 'Unit(dimensionless)'

raise TypeError('only dimensionless scalar quantities can be '
TypeError: only dimensionless scalar quantities can be converted to Python scalars

@TomHilder
Copy link

I am also having this issue

@akhil-lasrado
Copy link

The issue seems to arise in this line of the create_mask function (line 491 of filfinder2D.py),

p.imshow(self.flat_img.value, interpolation='nearest',
                     origin="lower", cmap='binary', vmin=vmin, vmax=vmax)

Since vmin and vmax are defined by,

vmin = np.percentile(self.flat_img[np.isfinite(self.flat_img)], 20)
vmax = np.percentile(self.flat_img[np.isfinite(self.flat_img)], 90)

they retain units from self.flat_img, and don't work as limits (which need to be dimensionless in this case). Just changing vmin=vmin, vmax=vmax to vmin=vmin.value, vmax=vmax.value in lines 491 and 545 of filfinder2D.py (for medskel plotting) did the trick for me.

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

No branches or pull requests

3 participants