Closed tjof2 closed 7 years ago
hey, I am trying to test PGURE-SVT and seem to have hit this bug. Tried installing hyperspy 1.0, but could not get that working either. Suggestions?
Hi @hentr, you could perhaps try v0.8.5 https://github.com/hyperspy/hyperspy/releases/tag/v0.8.5
Failing that, I'll address this issue this week.
Got it working with 0.8.5. Thanks, testing how well it works now with my data now :)
Great algorithm, it works really well with my data! However I cannot seem to save the image series after denoising, a bit frustrating when I have open a couple of image series that each took about 5 hrs to process. denoised_movie.save("s17_denoised.tif")
gives:
TypeError Traceback (most recent call last)
<ipython-input-3-ae9abdf9823c> in <module>()
----> 1 denoised_movie.save("s17_denoised.tif")
C:\Users\hent\AppData\Local\Continuum\Anaconda3\envs\hs0.85\lib\site-packages\hyperspy\signal.py in save(self, filename, overwrite, extension, **kwds)
1893 basename, ext = os.path.splitext(filename)
1894 filename = basename + '.' + extension
-> 1895 io.save(filename, self, overwrite=overwrite, **kwds)
1896
1897 def _replot(self):
C:\Users\hent\AppData\Local\Continuum\Anaconda3\envs\hs0.85\lib\site-packages\hyperspy\io.py in save(filename, signal, overwrite, **kwds)
424 overwrite = hyperspy.misc.io.tools.overwrite(filename)
425 if overwrite is True:
--> 426 writer.file_writer(filename, signal, **kwds)
427 print('The %s file was created' % filename)
428 folder, filename = os.path.split(os.path.abspath(filename))
C:\Users\hent\AppData\Local\Continuum\Anaconda3\envs\hs0.85\lib\site-packages\hyperspy\io_plugins\tiff.py in file_writer(filename, signal, **kwds)
89 software="hyperspy",
90 photometric=photometric,
---> 91 **kwds)
92
93
C:\Users\hent\AppData\Local\Continuum\Anaconda3\envs\hs0.85\lib\site-packages\hyperspy\external\tifffile.py in imsave(filename, data, **kwargs)
206
207 with TiffWriter(filename, **tifargs) as tif:
--> 208 tif.save(data, **kwargs)
209
210
C:\Users\hent\AppData\Local\Continuum\Anaconda3\envs\hs0.85\lib\site-packages\hyperspy\external\tifffile.py in save(self, data, photometric, planarconfig, resolution, description, volume, writeshape, compress, extratags)
511
512 if self._software:
--> 513 addtag('software', 's', 0, self._software, writeonce=True)
514 self._software = None # only save to first page
515 if description:
C:\Users\hent\AppData\Local\Continuum\Anaconda3\envs\hs0.85\lib\site-packages\hyperspy\external\tifffile.py in addtag(code, dtype, count, value, writeonce)
480 rawcount = count
481 if dtype == 's':
--> 482 value = bytestr(value) + b'\0'
483 count = rawcount = len(value)
484 value = (value, )
C:\Users\hent\AppData\Local\Continuum\Anaconda3\envs\hs0.85\lib\site-packages\hyperspy\external\tifffile.py in <lambda>(x)
455
456 bytestr = bytes if sys.version[0] == '2' else (
--> 457 lambda x: bytes(x) if isinstance(x, str) else x)
458 tags = [] # list of (code, ifdentry, ifdvalue, writeonce)
459
TypeError: string argument without an encoding
Would guess current tifffile.py does not match well with the old hyperspy?
@hentr That might be it - you can always export to HDF5 from the old HyperSpy and reimport that into a newer version of HyperSpy (virtual envs should be your friend here!)? The file format should be compatible across HS versions.
I'm sorry about this as a workaround, I'll fix this as soon as I can.
That was exactly what I ended up doing
@tjof2 is it a quick fix to update to newer HyperSpy? I am currently trying to automate denoising and analysis of larger amounts of data, and working in two environments for this is a pain. Do you have time to have a look at it?
Hi @hentr sorry I've not had time, it's been incredibly busy here.
The bit that is broken is all in this file https://github.com/tjof2/pgure-svt/blob/master/pguresvt/hspysvt.py; the change required are in the HyperSpy signal (which changed when HyperSpy moved to v1+). @bm424 might be able to help as he wrote it.
If you're able to work out a way of fixing it yourself, please do submit a PR and I'll merge it.
i.e. the key change in HyperSpy:
Changed in version 1.0: The Signal1D, Signal2D and BaseSignal classes deprecated the old Spectrum Image and Signal classes.
I'm not very good with python yet, but having had a quick look at it hspysvt.py, I think I should be able to figure it out.
Current HyperSpy wrapper was written for an old version - needs updating to work with v1.1.