java.lang.Object
org.eclipse.dawnsci.analysis.dataset.function.Downsample
All Implemented Interfaces:
IDownsampleService, DatasetToDatasetFunction

public class Downsample extends Object implements DatasetToDatasetFunction, IDownsampleService
Down-sample a dataset by a given bin. Also is the implementation of a service so instead of using this class directly, one can consume the IDownsampleService from OSGi thus not making a hard dependency on uk.ac.diamond.scisoft.analysis
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a default Downsample set to MAXIMUM with a 2x2 bin.
    Downsample(DownsampleMode mode, int... binShape)
    This class down-samples (or subsamples) datasets according to given mode and sample bin shape mode can be POINT, MEAN, MAXIMUM
  • Method Summary

    Modifier and Type
    Method
    Description
    static Downsample
     
    List<org.eclipse.january.dataset.Dataset>
    downsample(String enc, org.eclipse.january.dataset.IDataset... data)
    Downsample As in Downsample.fromString(...) In DAWN source code the implementation of this service is:
    List<org.eclipse.january.dataset.Dataset>
    downsample(DownsampleMode mode, int[] binShape, org.eclipse.january.dataset.IDataset... data)
    Same as the downsample with a string argument but instead of encoding the types in the string, they are provided directly.
    static String
     
    boolean
     
    int[]
     
     
    int
     
    List<org.eclipse.january.dataset.Dataset>
    value(org.eclipse.january.dataset.IDataset... datasets)
    The class implements down-sampling of datasets

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Downsample

      public Downsample()
      Creates a default Downsample set to MAXIMUM with a 2x2 bin. Called by OSGi when contributing the IDownsampleService
    • Downsample

      public Downsample(DownsampleMode mode, int... binShape)
      This class down-samples (or subsamples) datasets according to given mode and sample bin shape mode can be POINT, MEAN, MAXIMUM
      Parameters:
      mode -
      binShape -
  • Method Details

    • downsample

      public List<org.eclipse.january.dataset.Dataset> downsample(String enc, org.eclipse.january.dataset.IDataset... data) throws Exception
      Description copied from interface: IDownsampleService
      Downsample As in Downsample.fromString(...) In DAWN source code the implementation of this service is:
      Specified by:
      downsample in interface IDownsampleService
      Parameters:
      enc - : examples: 'MEAN:2', 'MEAN:2x3', 'MAXIMUM:2x2', 'MINIMUM:4x4', 'POINT:2x3x4'
      data - - the datasets to downsample
      Throws:
      Exception - if downsample encoding is incorrect
      See Also:
      • "uk.ac.diamond.scisoft.analysis.dataset.function.Downsample"
    • downsample

      public List<org.eclipse.january.dataset.Dataset> downsample(DownsampleMode mode, int[] binShape, org.eclipse.january.dataset.IDataset... data) throws Exception
      Description copied from interface: IDownsampleService
      Same as the downsample with a string argument but instead of encoding the types in the string, they are provided directly.
      Specified by:
      downsample in interface IDownsampleService
      Parameters:
      mode -
      binShape -
      data -
      Returns:
      list of downsampled datasets
      Throws:
      Exception
    • value

      public List<org.eclipse.january.dataset.Dataset> value(org.eclipse.january.dataset.IDataset... datasets)
      The class implements down-sampling of datasets
      Specified by:
      value in interface DatasetToDatasetFunction
      Parameters:
      datasets -
      Returns:
      a list of down-sampled datasets
    • getMode

      public DownsampleMode getMode()
    • getBshape

      public int[] getBshape()
    • encode

      public static String encode(Downsample s)
    • decode

      public static Downsample decode(String enc)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object