Giter VIP home page Giter VIP logo

napari-nasa-samples's People

Contributors

haesleinhuepf avatar royerloic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

napari-nasa-samples's Issues

Error while downloading

Hi Loic @royerloic ,

I just tried your new cool plugin. After clicking File > Open Samples > Blue Marple, I received the error below. The other examples seem to work. :-)

(bio_39) C:\Users\rober>napari
C:\Users\rober\miniconda3\envs\bio_39\lib\site-packages\napari_tools_menu\__init__.py:179: FutureWarning: Public access to Window.qt_viewer is deprecated and will be removed in
v0.5.0. It is considered an "implementation detail" of the napari
application, not part of the napari viewer model. If your use case
requires access to qt_viewer, please open an issue to discuss.
  self.tools_menu = ToolsMenu(self, self.qt_viewer.viewer)
---------------------------------------------------------------------------
SSLCertVerificationError                  Traceback (most recent call last)
File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\connectionpool.py:703, in HTTPConnectionPool.urlopen(self=<urllib3.connectionpool.HTTPSConnectionPool object>, method='GET', url='/images/imagerecords/57000/57752/land_shallow_topo_east.tif', body=None, headers={'User-Agent': 'python-requests/2.28.0', 'Accept...br', 'Accept': '*/*', 'Connection': 'keep-alive'}, retries=Retry(total=0, connect=None, read=False, redirect=None, status=None), redirect=False, assert_same_host=False, timeout=Timeout(connect=None, read=None, total=None), pool_timeout=None, release_conn=False, chunked=False, body_pos=None, **response_kw={'decode_content': False, 'preload_content': False})
    702 # Make the request on the httplib connection object.
--> 703 httplib_response = self._make_request(
        self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x00000168507F48E0>
        conn = None
        method = 'GET'
        url = '/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
        timeout_obj = Timeout(connect=None, read=None, total=None)
        body = None
        headers = {'User-Agent': 'python-requests/2.28.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
        chunked = False
    704     conn,
    705     method,
    706     url,
    707     timeout=timeout_obj,
    708     body=body,
    709     headers=headers,
    710     chunked=chunked,
    711 )
    713 # If we're going to release the connection in ``finally:``, then
    714 # the response doesn't need to know about the connection. Otherwise
    715 # it will also try to release it and we'll have a double-release
    716 # mess.

File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\connectionpool.py:386, in HTTPConnectionPool._make_request(self=<urllib3.connectionpool.HTTPSConnectionPool object>, conn=<urllib3.connection.HTTPSConnection object>, method='GET', url='/images/imagerecords/57000/57752/land_shallow_topo_east.tif', timeout=Timeout(connect=None, read=None, total=None), chunked=False, **httplib_request_kw={'body': None, 'headers': {'User-Agent': 'python-requests/2.28.0', 'Accept...br', 'Accept': '*/*', 'Connection': 'keep-alive'}})
    385 try:
--> 386     self._validate_conn(conn)
        self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x00000168507F48E0>
        conn = <urllib3.connection.HTTPSConnection object at 0x000001683C1372E0>
    387 except (SocketTimeout, BaseSSLError) as e:
    388     # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.

File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\connectionpool.py:1040, in HTTPSConnectionPool._validate_conn(self=<urllib3.connectionpool.HTTPSConnectionPool object>, conn=<urllib3.connection.HTTPSConnection object>)
   1039 if not getattr(conn, "sock", None):  # AppEngine might not have  `.sock`
-> 1040     conn.connect()
        conn = <urllib3.connection.HTTPSConnection object at 0x000001683C1372E0>
   1042 if not conn.is_verified:

File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\connection.py:414, in HTTPSConnection.connect(self=<urllib3.connection.HTTPSConnection object>)
    412     context.load_default_certs()
--> 414 self.sock = ssl_wrap_socket(
        self.sock = None
        self = <urllib3.connection.HTTPSConnection object at 0x000001683C1372E0>
        conn = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
        self.key_file = None
        self.cert_file = None
        self.key_password = None
        self.ca_certs = 'C:\\Users\\rober\\miniconda3\\envs\\bio_39\\lib\\site-packages\\certifi\\cacert.pem'
        self.ca_cert_dir = None
        self.ca_cert_data = None
        server_hostname = 'eoimages.gsfc.nasa.gov'
        context = <ssl.SSLContext object at 0x000001683C13E5C0>
        tls_in_tls = False
    415     sock=conn,
    416     keyfile=self.key_file,
    417     certfile=self.cert_file,
    418     key_password=self.key_password,
    419     ca_certs=self.ca_certs,
    420     ca_cert_dir=self.ca_cert_dir,
    421     ca_cert_data=self.ca_cert_data,
    422     server_hostname=server_hostname,
    423     ssl_context=context,
    424     tls_in_tls=tls_in_tls,
    425 )
    427 # If we're using all defaults and the connection
    428 # is TLSv1 or TLSv1.1 we throw a DeprecationWarning
    429 # for the host.

File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\util\ssl_.py:449, in ssl_wrap_socket(sock=<socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, keyfile=None, certfile=None, cert_reqs=None, ca_certs=r'C:\Users\rober\miniconda3\envs\bio_39\lib\site-packages\certifi\cacert.pem', server_hostname='eoimages.gsfc.nasa.gov', ssl_version=None, ciphers=None, ssl_context=<ssl.SSLContext object>, ca_cert_dir=None, key_password=None, ca_cert_data=None, tls_in_tls=False)
    448 if send_sni:
--> 449     ssl_sock = _ssl_wrap_socket_impl(
        context = <ssl.SSLContext object at 0x000001683C13E5C0>
        server_hostname = 'eoimages.gsfc.nasa.gov'
        sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
        tls_in_tls = False
    450         sock, context, tls_in_tls, server_hostname=server_hostname
    451     )
    452 else:

File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\util\ssl_.py:493, in _ssl_wrap_socket_impl(sock=<socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ssl_context=<ssl.SSLContext object>, tls_in_tls=False, server_hostname='eoimages.gsfc.nasa.gov')
    492 if server_hostname:
--> 493     return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
        server_hostname = 'eoimages.gsfc.nasa.gov'
        ssl_context = <ssl.SSLContext object at 0x000001683C13E5C0>
        sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
    494 else:

File ~\miniconda3\envs\bio_39\lib\ssl.py:501, in SSLContext.wrap_socket(self=<ssl.SSLContext object>, sock=<socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname='eoimages.gsfc.nasa.gov', session=None)
    495 def wrap_socket(self, sock, server_side=False,
    496                 do_handshake_on_connect=True,
    497                 suppress_ragged_eofs=True,
    498                 server_hostname=None, session=None):
    499     # SSLSocket class handles server_hostname encoding before it calls
    500     # ctx._wrap_socket()
--> 501     return self.sslsocket_class._create(
        self.sslsocket_class = <class 'ssl.SSLSocket'>
        self = <ssl.SSLContext object at 0x000001683C13E5C0>
        sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
        server_side = False
        do_handshake_on_connect = True
        suppress_ragged_eofs = True
        server_hostname = 'eoimages.gsfc.nasa.gov'
        session = None
    502         sock=sock,
    503         server_side=server_side,
    504         do_handshake_on_connect=do_handshake_on_connect,
    505         suppress_ragged_eofs=suppress_ragged_eofs,
    506         server_hostname=server_hostname,
    507         context=self,
    508         session=session
    509     )

File ~\miniconda3\envs\bio_39\lib\ssl.py:1041, in SSLSocket._create(cls=<class 'ssl.SSLSocket'>, sock=<socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname='eoimages.gsfc.nasa.gov', context=<ssl.SSLContext object>, session=None)
   1040             raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1041         self.do_handshake()
        self = <ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
   1042 except (OSError, ValueError):

File ~\miniconda3\envs\bio_39\lib\ssl.py:1310, in SSLSocket.do_handshake(self=<ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, block=False)
   1309         self.settimeout(None)
-> 1310     self._sslobj.do_handshake()
        self = <ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
        self._sslobj = None
   1311 finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
File ~\miniconda3\envs\bio_39\lib\site-packages\requests\adapters.py:489, in HTTPAdapter.send(self=<requests.adapters.HTTPAdapter object>, request=<PreparedRequest [GET]>, stream=True, timeout=Timeout(connect=None, read=None, total=None), verify=True, cert=None, proxies=OrderedDict())
    488 if not chunked:
--> 489     resp = conn.urlopen(
        conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0x00000168507F48E0>
        request = <PreparedRequest [GET]>
        request.method = 'GET'
        url = '/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
        request.body = None
        request.headers = {'User-Agent': 'python-requests/2.28.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
        self = <requests.adapters.HTTPAdapter object at 0x00000168507F41F0>
        self.max_retries = Retry(total=0, connect=None, read=False, redirect=None, status=None)
        timeout = Timeout(connect=None, read=None, total=None)
    490         method=request.method,
    491         url=url,
    492         body=request.body,
    493         headers=request.headers,
    494         redirect=False,
    495         assert_same_host=False,
    496         preload_content=False,
    497         decode_content=False,
    498         retries=self.max_retries,
    499         timeout=timeout,
    500     )
    502 # Send the request.
    503 else:

File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\connectionpool.py:785, in HTTPConnectionPool.urlopen(self=<urllib3.connectionpool.HTTPSConnectionPool object>, method='GET', url='/images/imagerecords/57000/57752/land_shallow_topo_east.tif', body=None, headers={'User-Agent': 'python-requests/2.28.0', 'Accept...br', 'Accept': '*/*', 'Connection': 'keep-alive'}, retries=Retry(total=0, connect=None, read=False, redirect=None, status=None), redirect=False, assert_same_host=False, timeout=Timeout(connect=None, read=None, total=None), pool_timeout=None, release_conn=False, chunked=False, body_pos=None, **response_kw={'decode_content': False, 'preload_content': False})
    783     e = ProtocolError("Connection aborted.", e)
--> 785 retries = retries.increment(
        retries = Retry(total=0, connect=None, read=False, redirect=None, status=None)
        url = '/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
        method = 'GET'
        self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x00000168507F48E0>
    786     method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
    787 )
    788 retries.sleep()

File ~\miniconda3\envs\bio_39\lib\site-packages\urllib3\util\retry.py:592, in Retry.increment(self=Retry(total=0, connect=None, read=False, redirect=None, status=None), method='GET', url='/images/imagerecords/57000/57752/land_shallow_topo_east.tif', response=None, error=SSLError(SSLCertVerificationError(1, '[SSL: CERT... failed: certificate has expired (_ssl.c:1129)')), _pool=<urllib3.connectionpool.HTTPSConnectionPool object>, _stacktrace=<traceback object>)
    591 if new_retry.is_exhausted():
--> 592     raise MaxRetryError(_pool, url, error or ResponseError(cause))
        cause = 'unknown'
        error = SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)'))
        url = '/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
        _pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0x00000168507F48E0>
    594 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)

MaxRetryError: HTTPSConnectionPool(host='eoimages.gsfc.nasa.gov', port=443): Max retries exceeded with url: /images/imagerecords/57000/57752/land_shallow_topo_east.tif (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
File ~\miniconda3\envs\bio_39\lib\site-packages\napari\_qt\menus\file_menu.py:190, in FileMenu._rebuild_samples_menu.<locals>._add_sample(plg='napari-nasa-samples', smp='blue_marble', *args=(False,))
    189 def _add_sample(*args, plg=plugin_name, smp=samp_name):
--> 190     self._win._qt_viewer.viewer.open_sample(plg, smp)
        plg = 'napari-nasa-samples'
        smp = 'blue_marble'
        self._win = <napari._qt.qt_main_window.Window object at 0x0000016838AF9BE0>
        self = <napari._qt.menus.file_menu.FileMenu object at 0x000001684EA4FEE0>

File ~\miniconda3\envs\bio_39\lib\site-packages\napari\components\viewer_model.py:829, in ViewerModel.open_sample(self=Viewer(axes=Axes(visible=False, labels=True, col...._transform_active_layer at 0x0000016843D68310>}), plugin='napari-nasa-samples', sample='blue_marble', reader_plugin=None, **kwargs={})
    827 if callable(data):
    828     added = []
--> 829     for datum in data(**kwargs):
        data = <bound method SampleDataGenerator.open of SampleDataGenerator(key='blue_marble', display_name='Blue Marble', command='napari-nasa-samples.blue_marble')>
        kwargs = {}
    830         added.extend(self._add_layer_from_data(*datum))
    831     return added

File ~\miniconda3\envs\bio_39\lib\site-packages\npe2\manifest\contributions\_sample_data.py:44, in SampleDataGenerator.open(self=SampleDataGenerator(key='blue_marble', display_n...rble', command='napari-nasa-samples.blue_marble'), _registry=None, *args=(), **kwargs={})
     41 def open(
     42     self, *args, _registry: Optional["CommandRegistry"] = None, **kwargs
     43 ) -> List[LayerData]:
---> 44     return self.exec(args, kwargs, _registry=_registry)
        args = ()
        kwargs = {}
        self = SampleDataGenerator(key='blue_marble', display_name='Blue Marble', command='napari-nasa-samples.blue_marble')
        _registry = None

File ~\miniconda3\envs\bio_39\lib\site-packages\npe2\manifest\utils.py:67, in Executable.exec(self=SampleDataGenerator(key='blue_marble', display_n...rble', command='napari-nasa-samples.blue_marble'), args=(), kwargs={}, _registry=None)
     65 if kwargs is None:
     66     kwargs = {}
---> 67 return self.get_callable(_registry)(*args, **kwargs)
        kwargs = {}
        _registry = None
        args = ()
        self = SampleDataGenerator(key='blue_marble', display_name='Blue Marble', command='napari-nasa-samples.blue_marble')

File ~\miniconda3\envs\bio_39\lib\site-packages\napari_nasa_samples\_blue_marble.py:15, in make_sample_data()
     13 def make_sample_data():
     14     """Generates an image"""
---> 15     array = get_array("https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif")
     16     return [(array, {'name': "Blue Marble, NASA"})]

File ~\miniconda3\envs\bio_39\lib\site-packages\napari_nasa_samples\utils.py:14, in get_array(url='https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif')
     11 file_path = get_file_path(url)
     13 if not exists(file_path):
---> 14     download(url)
        url = 'https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
     16 if file_path.endswith('tif'):
     17     from tifffile import tifffile

File ~\miniconda3\envs\bio_39\lib\site-packages\napari_nasa_samples\utils.py:26, in download(url='https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif', chunk_size=1048576)
     25 def download(url, chunk_size=1024*1024):
---> 26     get_response = requests.get(url, stream=True)
        url = 'https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
     27     file_path = get_file_path(url)
     28     with open(file_path, 'wb') as f:

File ~\miniconda3\envs\bio_39\lib\site-packages\requests\api.py:73, in get(url='https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif', params=None, **kwargs={'stream': True})
     62 def get(url, params=None, **kwargs):
     63     r"""Sends a GET request.
     64
     65     :param url: URL for the new :class:`Request` object.
   (...)
     70     :rtype: requests.Response
     71     """
---> 73     return request("get", url, params=params, **kwargs)
        url = 'https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
        params = None
        kwargs = {'stream': True}

File ~\miniconda3\envs\bio_39\lib\site-packages\requests\api.py:59, in request(method='get', url='https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif', **kwargs={'params': None, 'stream': True})
     55 # By using the 'with' statement we are sure the session is closed, thus we
     56 # avoid leaving sockets open which can trigger a ResourceWarning in some
     57 # cases, and look like a memory leak in others.
     58 with sessions.Session() as session:
---> 59     return session.request(method=method, url=url, **kwargs)
        session = <requests.sessions.Session object at 0x00000168507F4070>
        method = 'get'
        url = 'https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif'
        kwargs = {'params': None, 'stream': True}

File ~\miniconda3\envs\bio_39\lib\site-packages\requests\sessions.py:587, in Session.request(self=<requests.sessions.Session object>, method='get', url='https://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_east.tif', params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=None, allow_redirects=True, proxies={}, hooks=None, stream=True, verify=None, cert=None, json=None)
    582 send_kwargs = {
    583     "timeout": timeout,
    584     "allow_redirects": allow_redirects,
    585 }
    586 send_kwargs.update(settings)
--> 587 resp = self.send(prep, **send_kwargs)
        prep = <PreparedRequest [GET]>
        send_kwargs = {'timeout': None, 'allow_redirects': True, 'proxies': OrderedDict(), 'stream': True, 'verify': True, 'cert': None}
        self = <requests.sessions.Session object at 0x00000168507F4070>
    589 return resp

File ~\miniconda3\envs\bio_39\lib\site-packages\requests\sessions.py:701, in Session.send(self=<requests.sessions.Session object>, request=<PreparedRequest [GET]>, **kwargs={'cert': None, 'proxies': OrderedDict(), 'stream': True, 'timeout': None, 'verify': True})
    698 start = preferred_clock()
    700 # Send the request
--> 701 r = adapter.send(request, **kwargs)
        adapter = <requests.adapters.HTTPAdapter object at 0x00000168507F41F0>
        kwargs = {'timeout': None, 'proxies': OrderedDict(), 'stream': True, 'verify': True, 'cert': None}
        request = <PreparedRequest [GET]>
    703 # Total elapsed time of the request (approximately)
    704 elapsed = preferred_clock() - start

File ~\miniconda3\envs\bio_39\lib\site-packages\requests\adapters.py:563, in HTTPAdapter.send(self=<requests.adapters.HTTPAdapter object>, request=<PreparedRequest [GET]>, stream=True, timeout=Timeout(connect=None, read=None, total=None), verify=True, cert=None, proxies=OrderedDict())
    559         raise ProxyError(e, request=request)
    561     if isinstance(e.reason, _SSLError):
    562         # This branch is for urllib3 v1.22 and later.
--> 563         raise SSLError(e, request=request)
        request = <PreparedRequest [GET]>
    565     raise ConnectionError(e, request=request)
    567 except ClosedPoolError as e:

SSLError: HTTPSConnectionPool(host='eoimages.gsfc.nasa.gov', port=443): Max retries exceeded with url: /images/imagerecords/57000/57752/land_shallow_topo_east.tif (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)')))

add imagecodecs as a requirement

Ran into the following error when trying to open the sample image:
ValueError: <COMPRESSION.LZW: 5> requires the 'imagecodecs' package

imagecodecs does not come with napari (except bundle_run) and may need to be listed as a requirement for this plugin?

Can't open Carina Nebula JWST image from napari-nasa-samples

Hi @royerloic!

I was playing around with your plugin, and I tried to look at the Carina Nebula image from File > Open Sample > napari-nasa-samples > Cosmic Cliffs, Carina Nebula, NIRCam Image, JWST, but I got the error below. All the other images worked fine, just this one didn't work.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/tifffile/tifffile.py:3609, in TiffFile.__init__(self=<tifffile.TiffFile 'STScI-01G7ETNMR8…64R4CVA1E6T.tif'>, file='/Library/Caches/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif', mode=None, name=None, offset=None, size=None, _multifile=None, _useframes=None, _parent=None, **kwargs={})
   3608 try:
-> 3609     byteorder = {b'II': '<', b'MM': '>', b'EP': '<'}[header[:2]]
        header = b'<?xm'
        header[:2] = b'<?'
   3610 except KeyError:

KeyError: b'<?'

During handling of the above exception, another exception occurred:

TiffFileError                             Traceback (most recent call last)
File ~/Desktop/napari/napari/_qt/menus/file_menu.py:239, in FileMenu._rebuild_samples_menu.<locals>._add_sample(plg='napari-nasa-samples', smp='cosmic_cliffs', *args=(False,))
    237 def _add_sample(*args, plg=plugin_name, smp=samp_name):
    238     try:
--> 239         self._win._qt_viewer.viewer.open_sample(plg, smp)
        plg = 'napari-nasa-samples'
        smp = 'cosmic_cliffs'
        self._win = <napari._qt.qt_main_window.Window object at 0x1866ffd00>
        self = <napari._qt.menus.file_menu.FileMenu object at 0x1890d9820>
    240     except MultipleReaderError as e:
    241         handle_gui_reading(
    242             e.paths,
    243             self._win._qt_viewer,
    244             plugin_name=plugin_name,
    245             stack=False,
    246         )

File ~/Desktop/napari/napari/components/viewer_model.py:861, in ViewerModel.open_sample(self=Viewer(axes=Axes(visible=False, labels=True, col...indings._transform_active_layer at 0x187eede50>}), plugin='napari-nasa-samples', sample='cosmic_cliffs', reader_plugin=None, **kwargs={})
    859 if callable(data):
    860     added = []
--> 861     for datum in data(**kwargs):
        data = <bound method SampleDataGenerator.open of SampleDataGenerator(key='cosmic_cliffs', display_name='Cosmic Cliffs, Carina Nebula, NIRCam Image, JWST', command='napari-nasa-samples.cosmic_cliffs')>
        kwargs = {}
    862         added.extend(self._add_layer_from_data(*datum))
    863     return added

File ~/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/npe2/manifest/contributions/_sample_data.py:44, in SampleDataGenerator.open(self=SampleDataGenerator(key='cosmic_cliffs', display...ST', command='napari-nasa-samples.cosmic_cliffs'), _registry=None, *args=(), **kwargs={})
     41 def open(
     42     self, *args, _registry: Optional["CommandRegistry"] = None, **kwargs
     43 ) -> List[LayerData]:
---> 44     return self.exec(args, kwargs, _registry=_registry)
        args = ()
        kwargs = {}
        self = SampleDataGenerator(key='cosmic_cliffs', display_name='Cosmic Cliffs, Carina Nebula, NIRCam Image, JWST', command='napari-nasa-samples.cosmic_cliffs')
        _registry = None

File ~/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/npe2/manifest/utils.py:65, in Executable.exec(self=SampleDataGenerator(key='cosmic_cliffs', display...ST', command='napari-nasa-samples.cosmic_cliffs'), args=(), kwargs={}, _registry=None)
     63 if kwargs is None:
     64     kwargs = {}
---> 65 return self.get_callable(_registry)(*args, **kwargs)
        kwargs = {}
        _registry = None
        args = ()
        self = SampleDataGenerator(key='cosmic_cliffs', display_name='Cosmic Cliffs, Carina Nebula, NIRCam Image, JWST', command='napari-nasa-samples.cosmic_cliffs')

File ~/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/napari_nasa_samples/_jwst_cosmic_cliffs.py:10, in make_sample_data()
      8 def make_sample_data():
      9     """Generates an image"""
---> 10     array = get_array("https://stsci-opo.org/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif")
     11     return [(array, {'name':'Cosmic Cliffs, Carina Nebula, JWST'})]

File ~/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/napari_nasa_samples/utils.py:18, in get_array(url='https://stsci-opo.org/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif')
     16 if file_path.endswith('tif'):
     17     from tifffile import tifffile
---> 18     array = tifffile.imread(file_path)
        file_path = '/Library/Caches/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif'
        tifffile = <module 'tifffile.tifffile' from '/Users/lgan/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/tifffile/tifffile.py'>
     19 else:
     20     import imageio

File ~/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/tifffile/tifffile.py:973, in imread(files='/Library/Caches/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif', aszarr=False, key=None, series=None, level=None, squeeze=None, maxworkers=None, name=None, offset=None, size=None, pattern=None, axesorder=None, categories=None, imread=None, sort=None, container=None, axestiled=None, ioworkers=1, chunkmode=None, fillvalue=None, zattrs=None, _multifile=None, _useframes=None, **kwargs={})
    968     files = files[0]
    970 if isinstance(files, str) or not isinstance(
    971     files, collections.abc.Sequence
    972 ):
--> 973     with TiffFile(
        files = '/Library/Caches/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif'
        name = None
        offset = None
        size = None
        _multifile = None
        _useframes = None
        is_flags = {}
    974         files,
    975         name=name,
    976         offset=offset,
    977         size=size,
    978         _multifile=_multifile,
    979         _useframes=_useframes,
    980         **is_flags,
    981     ) as tif:
    982         if aszarr:
    983             assert key is None or isinstance(key, int)

File ~/opt/anaconda3/envs/napari-dev-env/lib/python3.9/site-packages/tifffile/tifffile.py:3611, in TiffFile.__init__(self=<tifffile.TiffFile 'STScI-01G7ETNMR8…64R4CVA1E6T.tif'>, file='/Library/Caches/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif', mode=None, name=None, offset=None, size=None, _multifile=None, _useframes=None, _parent=None, **kwargs={})
   3609     byteorder = {b'II': '<', b'MM': '>', b'EP': '<'}[header[:2]]
   3610 except KeyError:
-> 3611     raise TiffFileError(f'not a TIFF file {header!r}')
   3613 version = struct.unpack(byteorder + 'H', header[2:4])[0]
   3614 if version == 43:
   3615     # BigTiff

TiffFileError: not a TIFF file b'<?xm'


I tried going to https://stsci-opo.org/STScI-01G7ETNMR8CBHQQ64R4CVA1E6T.tif and got this message:
Screen Shot 2022-07-14 at 12 12 01 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.