silx icon indicating copy to clipboard operation
silx copied to clipboard

Allow wildcards on the command line together with a dataset path

Open sdebionne opened this issue 2 years ago • 6 comments

The information that I need is not on the default plot but on the dataset itself. A little enhancement that would be handy for me:

$ silx view /tmp/test_hdf5_gray8s_*.h5::/entry_0000/instrument/Simulator/data
ERROR:silx.app.view.main:Filename '/tmp/test_hdf5_gray8s_*.h5' must be a file path

I try several variants with quotes but without luck.

sdebionne avatar Dec 17 '21 09:12 sdebionne

The * is indeed not supported in this case, but it is supposed to work if you provide the full filename.

t20100 avatar Dec 17 '21 11:12 t20100

it is supposed to work if you provide the full filename

Correct, it works. What I suggest here is a little extension to allow opening a given dataset for a set of (pattern matching) files. Just for convenience. It's probably doable with a little bit of bash scripting too...

sdebionne avatar Dec 20 '21 14:12 sdebionne

It would also be nice to be able to combine data file pattern and data path pattern like

silx view file_pattern*.hdf::entry*/data

Furthermore in the case where we have a valid nexus dataset we could request a specific slice. For example if we have a set of entries containing a 3D /data dataset that can be interpreted as an image (interpretation == image in h5py dataset attribute) then we could ask to display the last frame of the stack. We could provide this as another parameter like

silx view file_pattern*.hdf5::entry*/data::slice=-1

Or maybe update the current way to have something like:

silx view file_pattern*.hdf5::/entry*/data&slice=-1

Or maybe go to the silx DataUrl way like:

silx view file_pattern*.hdf5?path=/entry*/data&slice=-1

payno avatar Feb 17 '22 15:02 payno

@payno I would recommend you to contact @cpascual He was working sometime ago on URIs related to that.

vasole avatar Feb 17 '22 16:02 vasole

Hi. I don't know about the internal implementations of the URIs (or URI-like) in silx, so I can only talk in abstract terms based on my experience with taurus, and more specifically, with the h5file plugin for taurus.

In taurus we try to be strict in using URIs that conform to the RFC3986 (although we allow some exceptions in some specific cases). This may be interesting for standarisation, but it imposes restrictions that may not be worth to you... so just decide what better suits your case.

It would also be nice to be able to combine data file pattern and data path pattern like

In the context of RFC3986 the I'd say file_pattern*.hdf::entry*/data would be ok

we could request a specific slice.

For slices, we in taurus implemented them using the "fragment" part of the URI. This makes sense in the case of taurus because the path of the taurus URI always refers to whole hdf5 datasets and hence the slicing is done at client level (which is what the URI fragments are for ). Also, we decided to break the strict RFC here to allow using a python-slice-like syntax for the slicing.

However in the case of silx view, it may make sense to have the slice as part of the path (as in silx view file_pattern*.hdf5::entry*/data::slice=-1)

In any case, I recommend to read the TEP15 document in which we discuss relative merits of various ways of encoding the slices in the taurus URIS, since some may be of interest for silx.

cpascual avatar Feb 18 '22 09:02 cpascual

thanks a lot for all this information. This is great to be able to benefit from your experience on the topic.

payno avatar Feb 18 '22 10:02 payno