Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [science-iwg] Making your own Dataset

FYI I am changing the operations UI to add categories. This work might not be finished until early next week.
________________________________________
From: Matt.Gerring@xxxxxxxxxxxxx [Matt.Gerring@xxxxxxxxxxxxx]
Sent: 29 October 2014 12:35
To: science-iwg@xxxxxxxxxxx
Subject: [science-iwg] Making your own Dataset

Hi Vincent,

Making your own IDataset is a lot easier than implementing the IDataset interface, if as you say, you already have a lazy data object.

What you do is you use the class org.eclipse.dawnsci.analysis.dataset.impl.LazyDataset and provide it with an ILazyLoader. This loader could interface with your existing lazy dataset implementation, getting for instance double[].

Once you have your primitive array, there is a constructor for DoubleDataset (and for all other primitives, IntegerDataset etc.). The external code would then look like:

YourLazyDataObject lo = ...
ILazyLoader loader = new ILazyLoader() {
    ...
    public IDataset getDataset(IMonitor mon, int[] shape, int[] start, int[] stop, int[] step) throws Exception {
        // process the slice information using lo
        // end up with a double[], da
        return new DoubleDataset(da, ...)
    }
};
ILazyDataset lazy = new LazyDataset("data de Vincent:)", Dataset.FLOAT, size, shape, loader);

// Now you can slice these data with ISliceSystem (or slicing using the example code) and use them with the plotting IPlottingSystem - voila!


Matt

--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom




_______________________________________________
science-iwg mailing list
science-iwg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/science-iwg

--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom






Back to the top