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

Plate solving tutorial error #58

Closed
AlfredXiaSF opened this issue Mar 15, 2023 · 7 comments
Closed

Plate solving tutorial error #58

AlfredXiaSF opened this issue Mar 15, 2023 · 7 comments
Labels
bug Something isn't working v3.0.0

Comments

@AlfredXiaSF
Copy link
Contributor

When I run Plate solving tutorial follow document, I got an error.
Here is my code:

from prose import Sequence, blocks

plate = Sequence([
    blocks.detection.SegmentedPeaks(min_separation=15, n_stars=15),
    blocks.catalogs.PlateSolve(debug=True)
])

plate.run(image, show_progress=False)

and the error:

Output exceeds the [size limit](command:workbench.action.openSettings?%5B%22notebook.output.textLineLimit%22%5D). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?fe124561-7179-4dfa-8328-049ad16dff0c)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[e:\03_Projects\ImageProcess\imlt\prose\PlatSolving.ipynb](file:///E:/03_Projects/ImageProcess/imlt/prose/PlatSolving.ipynb) Cell 14 in ()
      [1](vscode-notebook-cell:/e%3A/03_Projects/ImageProcess/imlt/prose/PlatSolving.ipynb#X16sZmlsZQ%3D%3D?line=0) from prose import Sequence, blocks
      [3](vscode-notebook-cell:/e%3A/03_Projects/ImageProcess/imlt/prose/PlatSolving.ipynb#X16sZmlsZQ%3D%3D?line=2) plate = Sequence([
      [4](vscode-notebook-cell:/e%3A/03_Projects/ImageProcess/imlt/prose/PlatSolving.ipynb#X16sZmlsZQ%3D%3D?line=3)     blocks.detection.SegmentedPeaks(min_separation=15, n_stars=15),
      [5](vscode-notebook-cell:/e%3A/03_Projects/ImageProcess/imlt/prose/PlatSolving.ipynb#X16sZmlsZQ%3D%3D?line=4)     blocks.catalogs.PlateSolve(debug=True)
      [6](vscode-notebook-cell:/e%3A/03_Projects/ImageProcess/imlt/prose/PlatSolving.ipynb#X16sZmlsZQ%3D%3D?line=5) ])
----> [8](vscode-notebook-cell:/e%3A/03_Projects/ImageProcess/imlt/prose/PlatSolving.ipynb#X16sZmlsZQ%3D%3D?line=7) plate.run(image, show_progress=False)

File [c:\Users\Alfre\AppData\Local\Programs\Python\Python310\lib\site-packages\prose\core\sequence.py:103](file:///C:/Users/Alfre/AppData/Local/Programs/Python/Python310/lib/site-packages/prose/core/sequence.py:103), in Sequence.run(self, images, terminate, show_progress, loader)
    101 self.n_processed_images = 0
    102 self.discards = {}
--> 103 self._run(loader=loader)
    105 if terminate:
    106     self.terminate()

File [c:\Users\Alfre\AppData\Local\Programs\Python\Python310\lib\site-packages\prose\core\sequence.py:119](file:///C:/Users/Alfre/AppData/Local/Programs/Python/Python310/lib/site-packages/prose/core/sequence.py:119), in Sequence._run(self, loader)
    116 image.i = i
    118 for block in self.blocks:
--> 119     block._run(image)
    120     # This allows to discard image in any Block
    121     if image.discard:

File [c:\Users\Alfre\AppData\Local\Programs\Python\Python310\lib\site-packages\prose\core\block.py:54](file:///C:/Users/Alfre/AppData/Local/Programs/Python/Python310/lib/site-packages/prose/core/block.py:54), in Block._run(self, *args, **kwargs)
...
File [c:\Users\Alfre\AppData\Local\Programs\Python\Python310\lib\site-packages\prose\blocks\registration.py:10](file:///C:/Users/Alfre/AppData/Local/Programs/Python/Python310/lib/site-packages/prose/blocks/registration.py:10), in distance(p1, p2)
      9 def distance(p1, p2):
---> 10     return np.sqrt(np.power(p1[0] - p2[0], 2) + np.power(p1[1] - p2[1], 2))

TypeError: 'PointSource' object is not subscriptable

My system is Win11 22624.1391, Python version is 3.10.9, prose version is 2.3.0.

@lgrcia
Copy link
Owner

lgrcia commented Mar 15, 2023

@AlfredXiaSF , thanks for reporting!

I just pushed a fix in 843a89f (& 7bb12d4) (branch 2.3.1)

May I suggest you to switch to version 3.0.0 (documentation here)? I also fixed the bug there (f0debf2) and that will be our next well-maintained and tested version in the near future.

The tutorial should be running now but let me know if you see another issue!

@lgrcia lgrcia added bug Something isn't working v3.0.0 labels Mar 15, 2023
@lgrcia
Copy link
Owner

lgrcia commented Mar 15, 2023

For reference: working min_separation is fixed for good in 83f55e8

lgrcia added a commit that referenced this issue Mar 15, 2023
@lgrcia
Copy link
Owner

lgrcia commented Mar 16, 2023

@AlfredXiaSF, that's great you gave version 3.0 a try. Thanks!

I did some test yesterday and uploaded this tutorial (same as the one you followed but on version 3.0). As you experienced there are some breaking changes in the API (hence the change of main version number). For the plate solving, working with n=30 stars works (see tutorial).

Just a note that in prose we try to have the fastest plate solving, so we make some assumptions that are sometimes at the limit of working (but lead to fast plate solving if they do). It is a matter of trade-off and it is worth a formal note on that in the documentation. I will open an issue to create some guidelines in the documentation (#60)!

This is definitely improving the package, thanks a lot!

@AlfredXiaSF
Copy link
Contributor Author

@lgrcia Think you!
7bb12d4 works.

I noticed I follow the wrong tutorial, so I delete the last comment and change to version 3.0.

Version works too. But there is a bug:

# show cutout around 13-th source
cutout = image.cutout(13, 300, reset_source_index=False)
cutout.show()
cutout.plot_catalog("gaia", label=True, color="w")

report:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], line 2
      1 # show cutout around 13-th source
----> 2 cutout = image.cutout(13, 300, reset_source_index=False)
      3 cutout.show()
      4 cutout.plot_catalog("gaia", label=True, color="w")

TypeError: Image.cutout() got an unexpected keyword argument 'reset_source_index'

@lgrcia
Copy link
Owner

lgrcia commented Mar 16, 2023

My bad... this has not been refactored properly. Can you try with reset_index=False? (I am updating everything now!)

@AlfredXiaSF
Copy link
Contributor Author

Yes, reset_index=False works for me.

@lgrcia
Copy link
Owner

lgrcia commented Mar 16, 2023

Great! I'll close the issue then.

Note that you can use the lower-level package twirl for plate-solving (dev branch documentation here)

Thanks again for reporting this issue. Highly appreciated!

@lgrcia lgrcia closed this as completed Mar 16, 2023
schackey pushed a commit to schackey/prose_dev that referenced this issue May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v3.0.0
Projects
None yet
Development

No branches or pull requests

2 participants