safeName

safeName( String suggest ) → String

made a Java-style identifier from the provided string See Autoplot/src/scripts/safeName.jy which demonstrates this.

Parameters

suggest - a name, possibly containing spaces and illegal characters

Returns:

a Java-style identifier

[search for examples] [view on GitHub] [view on old javadoc] [view source]


saferName

saferName( String suggest ) → String

extra spaces and pipes cause problems in the Operations text field. Provide so that data sources can provide safer names, while we test safe-name requirements on a broader test set. Use of this method will allow us to see where changes are needed. TODO: where is this used?

Parameters

suggest - a name, possibly containing pipes (|)

Returns:

suggest, but with pipe converted to underscore.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


sawtooth

sawtooth( QDataSet t ) → QDataSet

generates a sawtooth from the tags, where a peak occurs with a period 2*PI. All values of T should be ge zero.

Parameters

t - the independent values

Returns:

/|/|/| sawtooth wave with a period of 2 PI.

See Also:

modp(QDataSet, QDataSet)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


setDepend0Cadence

setDepend0Cadence( QDataSet ds, String arg ) → QDataSet

set the cadence property for the DEPEND_0 data. This allows scripts to assert that the data is collected at a given rate, and connecting lines should be drawn.

 xx= [ 0,2,4,6,8,10 ]
 yy= [ 1,1,2,2,3,3 ]
 ds= dataset(xx,yy)
 ds= setDepend0Cadence( ds, '2' )
 

Parameters

ds - the data, which has a DEPEND_0 property.
arg - the string representing the cadence.

Returns:

the data, which now has a DEPEND_0 with the cadence.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setDepend1Cadence

setDepend1Cadence( QDataSet ds, String arg ) → QDataSet

set the cadence property for the DEPEND_1 data. This allows scripts to assert that the data is collected at a given rate, and connecting lines should be drawn.

 xx= findgen(6)*2
 yy= findgen(6)*'10Hz'
 yy[3:]= yy[3:]+'2Hz'
 zz= randn(6,6)
 ds= dataset(xx,yy,zz)
 ds= setDepend1Cadence( ds, '12Hz' )
 plot( ds )
 

Parameters

ds - the data, which has a DEPEND_1 property.
arg - the string representing the cadence.

Returns:

the data, which now has a DEPEND_1 with the cadence.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setNominalRange

setNominalRange( QDataSet ds, String arg ) → QDataSet

set the metadata property LIMITS_NOMINAL_MIN and LIMITS_NOMINAL_MAX, which are displayed in the series renderer as a yellow line.

Parameters

ds - a rank 1 dataset or rank 2 waveform
arg - the range, parsed as a datum range using the data units.

Returns:

the data with the METADATA tag added

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setValidRange

setValidRange( QDataSet ds, String arg ) → QDataSet

assert that the valid data is within the given range like "10 to 50000", where the range is parsed using DatumRangeUtil.parseDatumRange.

Parameters

ds - the data
arg - the formatted range

Returns:

the data with the VALID_MIN and VALID_MAX properties set.

See Also:

DatumRangeUtil#parseDatumRange(java.lang.String)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


setWarnRange

setWarnRange( QDataSet ds, String arg ) → QDataSet

set the metadata property LIMITS_WARN_MIN and LIMITS_WARN_MAX, which are displayed in the series renderer as a red line.

Parameters

ds - a rank 1 dataset or rank 2 waveform
arg - the range, parsed as a datum range using the data units.

Returns:

the data with the METADATA tag added

[search for examples] [view on GitHub] [view on old javadoc] [view source]


shortarr

shortarr( int len0 ) → QDataSet

create a dataset filled with zeros, stored in 2-byte signed shorts. Note that shortarr is equivalent to intarr in IDL, containing integer values from -32768 to 32767.

Parameters

len0 - the zeroth dimension length

Returns:

rank 1 dataset filled with zeros.

See Also:

zeros(int)
dblarr(int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

shortarr( int len0, int len1 ) → QDataSet
shortarr( int len0, int len1, int len2 ) → QDataSet

shuffle

shuffle( QDataSet ds ) → QDataSet

returns a rank 1 dataset of indices that shuffle the rank 1 dataset ds.

s= shuffle( ds )
dsShuffled= ds[s]

Parameters

ds - rank 1 dataset

Returns:

rank 1 dataset of integer indices.

See Also:

sort(QDataSet)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

shuffle( Object ds ) → QDataSet

signum

signum( QDataSet ds1 ) → QDataSet

Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.

Parameters

ds1 - a QDataSet

Returns:

a QDataSet

See Also:

copysign
negate


[search for examples] [view on GitHub] [view on old javadoc] [view source]

signum( double x ) → double
signum( Object x ) → QDataSet

sin

sin( QDataSet ds ) → QDataSet

element-wise sin.

Parameters

ds - the angles in radians or degrees, and data without units are treated as radians.

Returns:

the sin of the angles

[search for examples] [view on GitHub] [view on old javadoc] [view source]

sin( double ds ) → double
sin( Object ds ) → QDataSet

sinh

sinh( QDataSet ds ) → QDataSet

element-wise sinh.

Parameters

ds - a QDataSet

Returns:

a QDataSet

[search for examples] [view on GitHub] [view on old javadoc] [view source]

sinh( double ds ) → double
sinh( Object ds ) → QDataSet

size

size( QDataSet ds ) → int

returns the number of elements in each index. E.g:

 ds= zeros(3,4)
 print size(ds) # returns "3,4"
 
Note datasets need not have the same number of elements in each record. This is often the case however, and a "qube" dataset has this property.

Parameters

ds - a qube dataset.

Returns:

the array containing number of elements in each index.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


slice0

slice0( QDataSet ds, int idx ) → QDataSet

returns the slice at the given slice location.

Parameters

ds - the rank N (N>0) or more dataset
idx - the index

Returns:

rank N-1 dataset

See Also:

QDataSet#slice(int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

slice0( QDataSet ds, QDataSet sliceds ) → QDataSet

slice1

slice1( QDataSet ds, int idx ) → QDataSet

returns the slice at the given slice location.

Parameters

ds - the rank N where N≥2 dataset, which is also a qube.
idx - the index to slice at.

Returns:

rank N-1 dataset.

See Also:

org.das2.qds.DataSetOps#slice1(QDataSet, int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

slice1( QDataSet ds, QDataSet sliceds ) → QDataSet

slice2

slice2( QDataSet ds, int idx ) → QDataSet

returns the slice at the given slice location.

Parameters

ds - the rank N where N≥3 dataset, which is also a qube.
idx - the index to slice at.

Returns:

rank N-1 dataset.

See Also:

org.das2.qds.DataSetOps#slice2(QDataSet, int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

slice2( QDataSet ds, QDataSet sliceds ) → QDataSet

slice3

slice3( QDataSet ds, int idx ) → QDataSet

returns the slice at the given slice location.

Parameters

ds - the rank N where N≥4 dataset, which is also a qube.
idx - the index to slice at.

Returns:

rank N-1 dataset.

See Also:

org.das2.qds.DataSetOps#slice3(QDataSet, int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

slice3( QDataSet ds, QDataSet sliceds ) → QDataSet

slices

slices( QDataSet ds, java.lang.Object[] args ) → QDataSet

slice each dimension in one call, so that chaining isn't required to slice multiple dimensions at once.

Parameters

ds - the dataset
args - varargs list of integers that are slice indices, or "" or ":" to mean don't slice

Returns:

the dataset with slices performed.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


smooth

smooth( QDataSet ds, int size ) → QDataSet

run boxcar average over the dataset, returning a dataset of same geometry. Points near the edge are simply copied from the source dataset. The result dataset contains a property "weights" that is the weights for each point. For rank 2 datasets, the smooth is done on the zeroth dimension, typically time. Note IDL does the smooth in both X and Y.

Parameters

ds - a rank 1 or rank 2 dataset of length N
size - the number of adjacent bins to average

Returns:

rank 1 or rank 2 dataset of length N

See Also:

smooth2d(QDataSet, int, int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

smooth( Object ds, int size ) → QDataSet

smooth1

smooth1( QDataSet ds, int size ) → QDataSet

smooth over the first dimension (not the zeroth). For example, for ds[Time,Energy], this will smooth over energy.

Parameters

ds - rank 2 dataset.
size - the boxcar size

Returns:

smoothed dataset with the same geometry.

See Also:

detrend1(QDataSet, int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


smooth2d

smooth2d( QDataSet ds, int n0, int n1 ) → QDataSet

smooth in both the first and second dimensions. Presently, this just calls smooth and then smooth1.

Parameters

ds - rank 2 data
n0 - the boxcar size in the first dimension
n1 - the boxcar size in the second dimension

Returns:

data with the same geometry

See Also:

smooth(QDataSet, int)
smooth1(QDataSet, int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]


smoothFit

smoothFit( QDataSet xx, QDataSet yy, int size ) → QDataSet

run boxcar average over the dataset, returning a dataset of same geometry. Points near the edge are fit to a line and replaced. The result dataset contains a property "weights" that is the weights for each point.

Parameters

xx - a rank 1 dataset of size N
yy - a rank 1 dataset of size N
size - the number of adjacent bins to average. If size is greater than yy.length, size is reset to yy.length.

Returns:

rank 1 dataset of size N

[search for examples] [view on GitHub] [view on old javadoc] [view source]

smoothFit( Object xx, Object yy, int size ) → QDataSet

sort

sort( QDataSet ds ) → QDataSet

returns a rank 1 dataset of indices that sort the rank 1 dataset ds. This is not the dataset sorted. For example:

ds= randn(2000)
s= sort( ds )
dsSorted= ds[s]
Note the result will have the property MONOTONIC==Boolean.TRUE if the data was sorted already.

Parameters

ds - rank 1 dataset

Returns:

rank 1 dataset of indices that sort the input dataset.

See Also:

shuffle(QDataSet)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

sort( Object ds ) → QDataSet

sortInTime

sortInTime( QDataSet ds ) → QDataSet

pick out the timetags and sort the data based on these. This only works when a dataset has DEPEND_0.

Parameters

ds - a dataset with tags in DEPEND_0.

Returns:

the data sorted by DEPEND_0.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


sqrt

sqrt( QDataSet ds ) → QDataSet

element-wise sqrt. See Ops.pow to square a number.

Parameters

ds - the dataset

Returns:

the square root of the dataset, which will contain NaN where the data is negative.

See Also:

pow(QDataSet, QDataSet)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

sqrt( double ds1 ) → double
sqrt( Object ds1 ) → QDataSet

square

square( QDataSet t ) → QDataSet

generates a square from the tags, where a the signal is 1 from 0-PI, 0 from PI-2*PI, etc.

Parameters

t - the independent values.

Returns:

square wave with a period of 2 PI.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


stddev

stddev( Object o ) → QDataSet

standard deviation function.

Parameters

o - an object which can be interpreted as a rank N dataset.

Returns:

rank 0 dataset with units matching those of the input.

[search for examples] [view on GitHub] [view on old javadoc] [view source]

stddev( QDataSet ds ) → QDataSet

strarr

strarr( int len0 ) → QDataSet

return a QDataSet containing empty strings. This is used in Jython to create an array-like dataset where different strings are assigned after the array is made.

Parameters

len0 - the number of elements.

Returns:

QDataSet with EnumerationUnits and all elements containing the value for "".

[search for examples] [view on GitHub] [view on old javadoc] [view source]

strarr( int len0, int len1 ) → QDataSet

subset

subset( QDataSet ds, QDataSet w ) → QDataSet

return the data at the indices given. This will be a rank 1 QDataSet. Often the indices are created with the "where" function, for example: QDataSet r= Ops.subset( ds, Ops.where( Ops.gt( ds, 1 ) ) ) will return the subset of ds where ds is greater than 1.

Parameters

ds - rank N array, N > 0.
w - rank 1 dataset of length l indexing a rank 1 array, or rank 2 ds[l,N] indexing a rank N array.

Returns:

rank 1 indices.

See Also:

applyIndex(QDataSet, QDataSet) applyIndex, which does the same thing.


[search for examples] [view on GitHub] [view on old javadoc] [view source]


subtract

subtract( QDataSet ds1, QDataSet ds2 ) → QDataSet

subtract one dataset from another.

Parameters

ds1 - a rank N dataset
ds2 - a rank M dataset with compatible geometry

Returns:

the element-wise difference of the two datasets.

[search for examples] [view on GitHub] [view on old javadoc] [view source]

subtract( Object ds1, Object ds2 ) → QDataSet

synchronize

synchronize( QDataSet ds1, QDataSet ds ) → QDataSet

The first dataset's timetags are used to synchronize the second dataset to a set of common timetags. Presently, only interpolation is used, but other methods may be introduced soon. Note that when one of the dataset's DEPEND_0 is not monotonic, a monotonic subset of its points will be used. Ordinal units use the nearest neighbor interpolation.

Parameters

ds1 - the dataset providing timetags, or the timetags themselves.
ds - the single datasets to synch up.

Returns:

the single dataset evaluated at the other dataset's timetags.

See Also:

synchronizeNN(QDataSet, QDataSet)
synchronize(QDataSet, QDataSet...)
flattenWaveform(QDataSet)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

synchronize( QDataSet dsTarget, org.das2.qds.QDataSet[] dsSources ) → List

synchronizeNN

synchronizeNN( QDataSet ds1, QDataSet ds ) → QDataSet

The first dataset's timetags are used to synchronize the second dataset to a set of common timetags, using nearest neighbor interpolation. Note that when one of the dataset's DEPEND_0 is not monotonic, a monotonic subset of its points will be used. Ordinal units use the nearest neighbor interpolation.

Parameters

ds1 - the dataset providing timetags, or the timetags themselves.
ds - the single datasets to synch up.

Returns:

the single dataset evaluated at the other dataset's timetags.

See Also:

synchronize(QDataSet, QDataSet)
synchronizeNN(QDataSet, QDataSet...)
flattenWaveform(QDataSet)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

synchronizeNN( QDataSet dsTarget, org.das2.qds.QDataSet[] dsSources ) → List

synchronizeOne

synchronizeOne( QDataSet dsTarget, QDataSet dsSource ) → QDataSet

The first dataset's timetags are used to synchronize the single dataset to common timetags. Presently, data from dsSource will be interpolated to create data at dsTarget timetag locations, but other methods may be introduced soon. Ordinal units use the nearest neighbor interpolation.

Parameters

dsTarget - the dataset providing timetags, or the timetags themselves.
dsSource - the dataset to synch up. Its timetags must be monotonically increasing and non-repeating.

Returns:

the one dataset, synchronized.

See Also:

synchronize(QDataSet, QDataSet...)


[search for examples] [view on GitHub] [view on old javadoc] [view source]