FluidDataSet:
Filter:
Classes (extension) | Libraries > FluidCorpusManipulation

FluidDataSet : FluidDataObject : FluidServerObject : Object
ExtensionExtension

A set of data associated with identifiers.

Description

FluidDataSet is a container associating data points with identifiers.

Read more about FluidDataSet on the learn platform.

Class Methods

FluidDataSet.new(server)

Arguments:

server

The Server on which to construct this object

Inherited class methods

Instance Methods

.addPoint(identifier, buffer, action)

Add a new point to the FluidDataSet. The dimensionality of the FluidDataSet is governed by the size of the first point added. If the identifier already exists, or if the size of the data does not match the dimensionality of the FluidDataSet an error will be reported.

Arguments:

identifier

The identifier for the point.

buffer

A Buffer containing the data for the point.

action

A function to execute when the server has completed running addPoint

.getPoint(identifier, buffer, action)

Retrieve a point from the data set into a Buffer. If the identifier does not exist an error will be reported.

Arguments:

identifier

The identifier for the point to be retrieved.

buffer

A Buffer where the retrieved data will be stored.

action

A function to execute when the server has completed running getPoint

.setPoint(identifier, buffer, action)

Set the point. If the identifier exists, this method behaves like updatePoint. If the identifier doesn't exist, it behaves like addPoint.

Arguments:

identifier

The identifier for this point.

buffer

A Buffer containing the data for the point.

action

A function to execute when the server has completed running setPoint

.updatePoint(identifier, buffer, action)

Update an existing identifier's data. If the identifier does not exist, or if the size of the data does not match the dimensionality of the FluidDataSet an error will be reported.

Arguments:

identifier

The identifier for this point.

buffer

A Buffer containing the data for the point.

action

A function to execute when the server has completed running updatePoint

.deletePoint(identifier, action)

Remove a point from the data set. If the identifier doesn't exist an error will be reported.

Arguments:

identifier

The identifier to be deleted.

action

A function to execute when the server has completed running deletePoint

.merge(sourceDataSet, overwrite: 0, action)

Merge sourceDataSet in the current DataSet. It will replace the value of points with the same identifier if overwrite is set to 1. ​To add columns instead, see the 'transformJoin' method of FluidDataSetQuery.

Arguments:

sourceDataSet

The source DataSet to be merged.

overwrite

A flag to allow overwrite points with the same identifier.

action

A function to execute when the server has completed running merge

.dump(action)

From superclass: FluidDataObject

Dump the state of this object as a Dictionary.

Arguments:

action

A function to execute when the server has completed running dump

.load(dict, action)

From superclass: FluidDataObject

Replace the internal state of the object from a Dictionary.

Arguments:

dict
action

A function to execute when the server has completed running load

.print(action)

Post an abbreviated content of the DataSet in the window by default, but you can supply a custom action instead.

Arguments:

action

A function to execute when the server has completed running print

.size(action)

From superclass: FluidDataObject

The number of data points (entries / observations) in this model or dataset / labeset

Arguments:

action

A function to execute when the server has completed running size

.cols(action)

From superclass: FluidDataObject

The number of columns (dimensions) in this model or dataset / labeset

Arguments:

action

A function to execute when the server has completed running cols

.clear(action)

Empty the data set.

Arguments:

action

A function to execute when the server has completed running clear

.write(filename, action)

From superclass: FluidDataObject

Save the contents of the object to a JSON file on disk.

Arguments:

filename

Path of the file to load from

action

A function to execute when the server has completed running write

.read(filename, action)

From superclass: FluidDataObject

Replace the internal state of the object from a JSON file on disk.

Arguments:

filename

Path of the file to load from

action

A function to execute when the server has completed running read

.fromBuffer(buffer, transpose: 0, labelSet, action)

Import to the dataset the content of a Buffer, with optional transposition, and a map of frames/channels to the original IDs as a FluidLabelSet.

Arguments:

buffer

The buffer to read from. The dataset will be resized.

transpose

If 0, each buffer frame becomes a dataset point, and each buffer channel becomes a dataset dimension. If 1, channels become points, and frames become dimensions.

labelSet

The FluidLabelSet from which to retrieve the point's IDs associated with their reference frame number (or channel number if transposed).

action

A function to execute when the server has completed running fromBuffer

.toBuffer(buffer, transpose: 0, labelSet, action)

Dump the content of the dataset to a Buffer, with optional transposition, and a map of frames/channels to the original IDs as a FluidLabelSet.

Arguments:

buffer

The buffer to write to. It will be resized.

transpose

If 0, each dataset point becomes a buffer frame, and each dataset dimension becomes a buffer channel. If 1, points become channels, and dimensions become frames.

labelSet

The FluidLabelSet in which to dump the point's IDs associated with their reference frame number (or channel number if transposed).

action

A function to execute when the server has completed running toBuffer

.getIds(labelSet, action)

Export the dataset identifier to a FluidLabelSet.

Arguments:

labelSet

The FluidLabelSet to export to. Its content will be replaced.

action

A function to execute when the server has completed running getIds

.kNearest(buffer, k, action)

Returns the identifiers of the k points nearest to the one passed. Note that this is a brute force distance measure, and comparatively inefficient for repeated queries against large datasets. For such cases, FluidKDTree will be more efficient.

Arguments:

buffer

A Buffer containing a data point to match against. The number of frames in the buffer must match the dimensionality of the DataSet.

k

The number of nearest neighbours to return. The identifiers will be sorted, beginning with the nearest.

action

A function to execute when the server has completed running kNearest

Inherited instance methods

Undocumented instance methods

.addPointMsg(identifier, buffer)

.clearMsg

.deletePointMsg(identifier)

.fromBufferMsg(buffer, transpose: 0, labelSet)

.getIdsMsg(labelSet)

.getPointMsg(identifier, buffer)

.kNearestMsg(buffer, k)

.mergeMsg(sourceDataSet, overwrite: 0)

.printMsg

.setPointMsg(identifier, buffer)

.toBufferMsg(buffer, transpose: 0, labelSet)

.updatePointMsg(identifier, buffer)

Examples

Adding an audio analysis to a DataSet

Four ways to get a bunch of data into a dataset

More Messages

Merge two data sets that have the same number of dimensions

Using .fromBuffer

Nearest Neighbour Search in a DataSet

Note: A FluidDataSet can be queried with an input point to return the nearest match to that point. Note: This feature is can be computationally expensive on a large dataset, as it needs to compute the distance of the queried point to each point in the dataset. If you need to perform multiple nearest neighbour queries on a fluid.dataset~ it is recommended to use FluidKDTree. This facility is most useful with smaller, ephemeral datasets such as those returned by FluidDataSetQuery.