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

Ellipse method with geometry argument just getting stuck and not loading all of a sudden in Jupyter notebook #1693

Open
shruti-ramaiya opened this issue Jan 17, 2024 · 4 comments

Comments

@shruti-ramaiya
Copy link

shruti-ramaiya commented Jan 17, 2024

I am doing an analysis that involves using fitting elliptical isophotes around galaxy images for which I am using photutils

For a galaxy image, I first begin by using the Ellipse class, as the galaxy is centered in the image and this works as expected

The code for which is,

`ellipse = Ellipse(my_image)

isolist = ellipse.fit_image()

isolist.to_table() #displaying results using astropy table method
`

Now, for most of my data, the galaxy is NOT centered in the image, so using the same galaxy image example, I do the same process but this time passing the geometry argument into the instance of the Ellipse class. For the geometry object I input the same centre coordinates and this was all working fine. Doing so gave me the exact same results as when I omitted the geometry argument, which is what was expected.

The code for which is,

`

geometry = EllipseGeometry(x0=150,y0=150,sma=0.,eps=0.,pa=0.)

ellipse = Ellipse(my_image,geometry=geometry)

isolist = ellipse.fit_image()

isolist.to_table() #displaying results using astropy table method
`

For the last couple days this was working perfectly and running extremely quickly.

Now all of a sudden, the code block where I input the geometry object is just not loading in my jupyter notebook. It is getting stuck on the fit_image() portion of the code and just failing to load at all, its just getting stuck on *. I have changed nothing and I am not sure why all of a sudden this is happening. It loads very quick when I remove the geometry argument but it was running quick before even with this argument and nothing has changed

I thought perhaps a memory issue? Something due to me rerunning that code block multiple times but even after clearing jupyter notebook memory and trying again the same issue persists.

I am only confused as it was running very quick prior to this and then now won't load at all.

If anyone has any ideas or suggestions as to why this is happening I would be most grateful

@larrybradley
Copy link
Member

Did you change the packages (or update versions) in your Python environment? That would be the only explanation I can think of for why things suddenly changed behavior. Also, the isophote code in Photutils has not changed since version 1.7.0 -- and that was only a bugfix in the calculation of upper harmonics.

@shruti-ramaiya
Copy link
Author

shruti-ramaiya commented Jan 18, 2024 via email

@larrybradley
Copy link
Member

larrybradley commented Jan 18, 2024

@shruti-ramaiya Here's an example of an "off-center" isophotal fit (modified from the example shown in the docs here: https://photutils.readthedocs.io/en/latest/isophote.html):

https://gist.github.com/larrybradley/07f58039917dada1e84a725de2d7a313

It is important that your initial geometry be close/reasonable to the data. If not, the fit will fail. In the notebook above, I show how you can plot the initial ellipse geometry on the data to check.

Note that setting sma=0 will not work. sma is the semimajor axis length.

Also, if there are other sources in the image, the fit will likely fail.

@shruti-ramaiya
Copy link
Author

shruti-ramaiya commented Jan 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants