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

Cookie png missing in cuqi.data #335

Closed
jakobsj opened this issue Dec 20, 2023 · 0 comments · Fixed by #336
Closed

Cookie png missing in cuqi.data #335

jakobsj opened this issue Dec 20, 2023 · 0 comments · Fixed by #336
Assignees
Labels
bug Something isn't working

Comments

@jakobsj
Copy link
Contributor

jakobsj commented Dec 20, 2023

Description

I try to import the cookie phantom using Deconvolution2D

Example to reproduce

Tested on two different machines after installing CUQIpy 0.8.0, and also with prerelease after 0.8.0

import cuqi
from cuqi.testproblem import Deconvolution2D
A, y_data, info = Deconvolution2D(dim=256, phantom="cookie").get_components()

FileNotFoundError Traceback (most recent call last)
Cell In[4], line 1
----> 1 A, y_data, info = Deconvolution2D(dim=256, phantom="cookie").get_components()

File ~/anaconda3/envs/cuqipypre/lib/python3.10/site-packages/cuqi/testproblem/testproblem.py:1279, in Deconvolution2D.init(self, dim, PSF, PSF_param, PSF_size, BC, phantom, noise_type, noise_std, prior)
1277 phantom = phantom.lower().replace("-", "
")
1278 if hasattr(cuqi.data, phantom):
-> 1279 x_exact2D = getattr(cuqi.data, phantom)(size=dim)
1280 else:
1281 raise ValueError(f"Phantom {phantom} not found in cuqi.data phantom library.")

File ~/anaconda3/envs/cuqipypre/lib/python3.10/site-packages/cuqi/data/_data.py:344, in cookie(size, grayscale)
320 """ Cartoon-style image of a cookie.
321
322 The image is generated from the cookie.png color image file in cuqi/data.
(...)
340
341 """
343 # Read cookie.png file and convert to rgb
--> 344 stream = pkg_resources.resource_stream(name, 'cookie.png')
345 cookie = plt.imread(stream)
347 # Convert to rgb

File ~/anaconda3/envs/cuqipypre/lib/python3.10/site-packages/pkg_resources/init.py:1219, in ResourceManager.resource_stream(self, package_or_requirement, resource_name)
1217 def resource_stream(self, package_or_requirement, resource_name):
1218 """Return a readable file-like object for specified resource"""
-> 1219 return get_provider(package_or_requirement).get_resource_stream(
1220 self, resource_name
1221 )

File ~/anaconda3/envs/cuqipypre/lib/python3.10/site-packages/pkg_resources/init.py:1724, in DefaultProvider.get_resource_stream(self, manager, resource_name)
1723 def get_resource_stream(self, manager, resource_name):
-> 1724 return open(self._fn(self.module_path, resource_name), 'rb')

FileNotFoundError: [Errno 2] No such file or directory: '/home/jakj/anaconda3/envs/cuqipypre/lib/python3.10/site-packages/cuqi/data/cookie.png'

And checking in that folder gives no cookie:

ls /home/jakj/anaconda3/envs/cuqipypre/lib/python3.10/site-packages/cuqi/data
astronaut.npz camera.npz cat.npz _data.py init.py pycache satellite.mat

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

Successfully merging a pull request may close this issue.

2 participants