Skip to content

Improved Export/Download support #687

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

Open
1 of 10 tasks
sk1p opened this issue Mar 18, 2020 · 10 comments
Open
1 of 10 tasks

Improved Export/Download support #687

sk1p opened this issue Mar 18, 2020 · 10 comments
Labels
enhancement New feature or request good first issue Good for newcomers GUI
Milestone

Comments

@sk1p
Copy link
Member

sk1p commented Mar 18, 2020

This is a continuation of #665, related to discussion in tickets #46, #168, #328

Now that the basic functionality is there, we can get first feedback from users; then it can be further improved:

  • Support for CSV/Text
  • Support for hspy
  • Support for more formats?
  • Better filenames, maybe including name from the GUI?
  • Support for writing analysis parameters into the exported file, to support reproducing the results
  • Find out: can other programs properly open multi-page TIFF documents? DM, HyperSpy, anything else?

Known issues

  • Image formats (currently TIFF) don't support complex data
  • Code quality in the GUI according to code climate can be improved, although most of the issues are not new...
  • If an analysis decides that it is a good idea to put channels of different dimensions into a single AnalysisResultSet, at least the TIFF writer will crash
  • CoM export is broken: Fix CoM result download #723
@sk1p sk1p added enhancement New feature or request GUI labels Mar 18, 2020
@sk1p sk1p added this to the 0.5 milestone Mar 18, 2020
@sk1p
Copy link
Member Author

sk1p commented Mar 18, 2020

HDF5 export of CoM is broken:

HTTPServerRequest(protocol='http', host='localhost:3000', method='GET', uri='/api/compoundAnalyses/88354ca5-bba4-43ca-b026-a90f5aa91136/analyses/ebac42fd-180a-41c1-bdb9-e641215fdf1d/download/HDF5/', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/home/alex/.virtualenvs/libertem/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
    result = await result
  File "/home/alex/source/LiberTEM/src/libertem/web/analysis.py", line 94, in get
    result_formatter.serialize_to_buffer(buf)
  File "/home/alex/source/LiberTEM/src/libertem/io/writers/results/formats.py", line 19, in serialize_to_buffer
    f[k] = self._result_set[k]
  File "/home/alex/.virtualenvs/libertem/lib/python3.7/site-packages/h5py/_hl/group.py", line 387, in __setitem__
    ds = self.create_dataset(None, data=obj, dtype=base.guess_dtype(obj))
  File "/home/alex/.virtualenvs/libertem/lib/python3.7/site-packages/h5py/_hl/group.py", line 136, in create_dataset
    dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
  File "/home/alex/.virtualenvs/libertem/lib/python3.7/site-packages/h5py/_hl/dataset.py", line 83, in make_new_dset
    else base.guess_dtype(data)))
  File "/home/alex/.virtualenvs/libertem/lib/python3.7/site-packages/numpy/core/_asarray.py", line 85, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: object __array__ method not producing an array

Reason: .raw_data is a tuple, and that's what is returned as the __array__. Maybe need to exclude this from the export - users can still get the x and y components as separate layers.

@sk1p
Copy link
Member Author

sk1p commented Mar 18, 2020

Note about multi-layered tiffs: they can be opened by Fiji, but are otherwise not widely supported. Float TIFF in general has bad support in normal image editors, same deal with multi-page/layer support. Might need an option to download channels separately, or as a zip of tiffs.

@matkraj
Copy link

matkraj commented Apr 2, 2020

@sk1p Download function is great! On my system any CoM result (x,y,RGB) goes into

500: Internal Server Error

and in console:

tornado.application - ERROR - Uncaught exception GET /api/compoundAnalyses/bb9adb50-1b7d-498d-830c-bc06cbe183e9/analyses/32c1c272-4d22-4435-b32a-f8e9698d4d52/download/TIFF/ (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:9000', method='GET', uri='/api/compoundAnalyses/bb9adb50-1b7d-498d-830c-bc06cbe183e9/analyses/32c1c272-4d22-4435-b32a-f8e9698d4d52/download/TIFF/', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/home/mk/anaconda3/envs/libertem/lib/python3.7/site-packages/tornado/web.py", line 1703, in _execute
    result = await result
  File "/home/mk/APPS/LiberTEM/src/libertem/web/analysis.py", line 94, in get
    result_formatter.serialize_to_buffer(buf)
  File "/home/mk/APPS/LiberTEM/src/libertem/io/writers/results/formats.py", line 81, in serialize_to_buffer
    first_image = next(images)
  File "/home/mk/APPS/LiberTEM/src/libertem/io/writers/results/formats.py", line 76, in get_channel_images
    result = np.array(self._result_set[k]).astype(np.float32)
ValueError: object __array__ method not producing an array

@sk1p
Copy link
Member Author

sk1p commented Apr 6, 2020

@matkraj thanks for the feedback and for trying out the new feature! Yeah, I still have to think about how to best support downloading CoM results. Would it work for you if the x and y components were available as separate "layers"? I also thought about returning complex values, but that won't work well for both tiff and raw export, as far as I can tell...

@matkraj
Copy link

matkraj commented Apr 7, 2020

@sk1p I would prefer multiframe TIFFs -> I just tested a 2 layer 32 bit TIFF and they are supported by GIMP (v2.10 up to date version at least, only trouble is that it does not stretch the contrast out of the box, Colors > Auto > Stretch contrast needs to be used). I guess complex images can be separated into 2 frames and imported like that.

@uellue
Copy link
Member

uellue commented Apr 7, 2020

Note about multi-layered tiffs: the can be opened by Fiji, but are otherwise not widely supported. Float TIFF in general has bad support in normal image editors, same deal with multi-page/layer support. Might need an option to download channels separately, or as a zip of tiffs.

A zip with layers as individual files sounds like a good idea!

@uellue uellue modified the milestones: 0.5, 0.6 Apr 7, 2020
@bdalevin
Copy link
Contributor

bdalevin commented Apr 9, 2020

I'm unable to save COM images in any format. When I try to do so, the server GUI becomes a blank page with the words "500: Internal Server Error" printed on the screen.

@uellue uellue modified the milestones: 0.6, 0.5 Apr 14, 2020
@uellue
Copy link
Member

uellue commented Apr 14, 2020

Temporarily assigned to 0.5 release to fix CoM 500 error in download. CC @sk1p

@sk1p sk1p mentioned this issue Apr 15, 2020
4 tasks
@sk1p sk1p modified the milestones: 0.5, 0.6 Apr 17, 2020
@sk1p sk1p removed their assignment Apr 17, 2020
@sk1p sk1p added the good first issue Good for newcomers label Jun 10, 2020
@sayandip18
Copy link
Contributor

sayandip18 commented Jun 10, 2020

  • Support for hspy

Is this the one? In that case, the link to the project is broken. It is described as a "python wrapper around the Citrix GoToWebinar REST API" in the description section.

However, the author does have a project named hspy which is described as "Django Middlewares to aide your HubSpot Marketplace development efforts".

The author has another project named gtwpy which is described as "python wrapper around the Citrix GoToWebinar REST API" (same as the one for hspy in PyPI).

I guess gtwpy is the one we need here.

@sk1p
Copy link
Member Author

sk1p commented Jun 10, 2020

I guess gtwpy is the one we need here.

@sayandip18 not related to gotowebinar, this is about the file format of hyperspy

@sk1p sk1p modified the milestones: 0.6, 0.7 Jun 15, 2020
@uellue uellue modified the milestones: 0.7, 0.8 May 27, 2021
@sk1p sk1p modified the milestones: 0.8, backlog Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers GUI
Projects
None yet
Development

No branches or pull requests

5 participants