org.das2.qds.QubeDataSetIterator
DataSetIterator implementation that can be used for all dataset (not just qubes).
Originally this only worked for QDataSets that were qubes, or datasets that
had the same dataset geometry for each slice. At some point this was
modified to work with any dataset but the name remains.
DataSetIterators are intended to work with multiple datasets at once. For example,
if we want to add the data from two datasets together, we would create one
iterator that would be used to access both datasets. One dataset is provided
to the constructor, but any dataset of the same geometry can be passed to the
getValue method.
TODO: This does not work for Rank 0 datasets. See
sftp://klunk.physics.uiowa.edu/home/jbf/project/autoplot/script/demos/jeremy/qubeDataSetIteratorForNonQubes.jy
QubeDataSetIterator( QDataSet ds )
dataset iterator to help in implementing the complex indexing
types of python. Each of the dimensions is set to iterate over all
indices (e.g ds[:,:,:])
Client codes should create a new iterator, set the index iterator factories, then iterate.
checkValidIndexList
checkValidIndexList( QDataSet ds, int indexSize ) → void
Parameters
ds - a QDataSet
indexSize - an int
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
createEmptyDs
createEmptyDs( ) → org.das2.qds.DDataSet
return a dataset that will have the same geometry at the
dataset implied by each dimension iterator. This is
introduced to encapsulate this dangerous code to here where it could
be done correctly. Right now this assumes QUBES.
Do not pass the result of this into the putValue of this iterator,
the result should have its own iterator.
20101006 jbf: copy dimensional metadata DEPEND_0, etc where possible
20120718 jbf: bugfix with ds[7,16,4,:]. Support BINS.
Returns:
empty dataset with structural properties set.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
currentJythonLine
currentJythonLine( ) → String
return the current line in the Jython script as <filename>:<linenum>
or ??? if this cannot be done. Note calls to this will collect a stack
trace and will affect performance.
Returns:
the current line or ???
See Also:
JythonOps#currentLine()
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getRank0Value
getRank0Value( QDataSet ds ) → QDataSet
Parameters
ds - a QDataSet
Returns:
org.das2.qds.QDataSet
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getValue
getValue( QDataSet ds ) → double
Parameters
ds - a QDataSet
Returns:
double
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
hasNext
hasNext( ) → boolean
true if there are more values.
Returns:
true if there are more values.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
index
index( int dim ) → int
Parameters
dim - an int
Returns:
int
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
length
length( int dim ) → int
Parameters
dim - an int
Returns:
int
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
next
next( ) → void
advance to the next index. getValue(ds) will return the value of the
dataset at this index.
Returns:
void (returns nothing)
See Also:
getValue(QDataSet)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
putRank0Value
putRank0Value( org.das2.qds.WritableDataSet ds, QDataSet vds ) → void
Parameters
ds - a WritableDataSet
vds - a QDataSet
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
putValue
putValue( org.das2.qds.WritableDataSet ds, double v ) → void
Parameters
ds - a WritableDataSet
v - a double
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
rank
rank( ) → int
Returns:
int
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
setIndexIteratorFactory
setIndexIteratorFactory( int dim, org.das2.qds.QubeDataSetIterator.DimensionIteratorFactory fit ) → void
reinitializes the iterator.
Parameters
dim - the dimension index (0,...,rank-1)
fit - the iterator factory to use for the index.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
setMonitor
setMonitor( ProgressMonitor mon ) → void
convenient method for monitoring long processes, this allows
clients to let the iterator manage the monitor. setTaskSize,
started, setTaskProgress, and finished are called automatically.
The monitor will reflect the zeroth index.
Parameters
mon - the monitor, or null.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
sliceIterator
sliceIterator( QDataSet ds, int sliceIndex ) → org.das2.qds.QubeDataSetIterator
return an iterator for the slice of a dataset (on the 0th index).
This is introduced to improve performance by reducing the number of
bounds checks, etc from the general case. Note slice is a native
operation for most datasets now, so this is probably obsolete.
Parameters
ds - the dataset.
sliceIndex - the index of the slice.
Returns:
an iterator for the slice.
See Also:
QDataSet#slice(int)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
toString
toString( ) → String
Returns:
java.lang.String
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]