## 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. TODO: I think there should be a modp function that is always positive. (-93 % 10 →7 though...)

### Parameters

t - the independent values

### Returns:

/|/|/| sawtooth wave with a period of 2 PI.
[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

shortarr( int len0, int len1 ) → QDataSet

create a rank 2 dataset filled with zeros, stored in 2-byte shorts.

### Parameters

len0 - the length of the zeroth dimension.
len1 - the length of the first dimension.

### Returns:

rank 2 dataset filled with zeros.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## shortarr

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

create a rank 3 dataset filled with zeros, stored in 2-byte shorts.

### Parameters

len0 - the length of the zeroth dimension.
len1 - the length of the first dimension.
len2 - the length of the second dimension.

### Returns:

rank 3 dataset filled with zeros.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## shuffle

shuffle( QDataSet ds ) → QDataSet

returns a rank 1 dataset of indeces that shuffle the rank 1 dataset ds

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

### Parameters

ds - rank 1 dataset

### Returns:

rank 1 dataset of integer indeces.

### See Also:

sort(QDataSet)
[search for examples] [view on GitHub] [view on old javadoc] [view source]
shuffle( Object ds ) → QDataSet [view source]

## 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 [view source]
signum( Object x ) → QDataSet [view source]

## sin

sin( QDataSet ds ) → QDataSet

element-wise sin.

### Parameters

ds - a QDataSet

### Returns:

a QDataSet
[search for examples] [view on GitHub] [view on old javadoc] [view source]
sin( double ds ) → double [view source]
sin( Object ds ) → QDataSet [view source]

## 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 [view source]
sinh( Object ds ) → QDataSet [view source]

## 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

### 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

slice0( QDataSet ds, QDataSet sliceds ) → QDataSet

returns the slice at the given slice location. The dataset must have monotonic DEPEND_0.

### Parameters

ds - ripples(20,20). Presently this must be a simple table.
sliceds - dataset("10.3")

### Returns:

the slice at the given location

### See Also:

trim(QDataSet, QDataSet, QDataSet)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## slice1

slice1( QDataSet ds, int idx ) → QDataSet

### Parameters

ds - a QDataSet
idx - an int

### Returns:

a QDataSet

### See Also:

org.das2.qds.DataSetOps#slice1(QDataSet, int)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## slice1

slice1( QDataSet ds, QDataSet sliceds ) → QDataSet

returns the slice at the given slice location.

### Parameters

ds - ripples(20,20). Presently this must be a simple table.
sliceds - dataset("10.3")

### Returns:

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

## slice2

slice2( QDataSet ds, int idx ) → QDataSet

### Parameters

ds - a QDataSet
idx - an int

### Returns:

a QDataSet

### See Also:

org.das2.qds.DataSetOps#slice2(QDataSet, int)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## slice2

slice2( QDataSet ds, QDataSet sliceds ) → QDataSet

returns the slice at the given slice location.

### Parameters

ds - ripples(20,20). Presently this must be a simple table.
sliceds - dataset("10.3")

### Returns:

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

## slice3

slice3( QDataSet ds, int idx ) → QDataSet

### Parameters

ds - a QDataSet
idx - an int

### Returns:

a QDataSet

### See Also:

org.das2.qds.DataSetOps#slice3(QDataSet, int)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## slice3

slice3( QDataSet ds, QDataSet sliceds ) → QDataSet

returns the slice at the given slice location.

### Parameters

ds - ripples(20,20). Presently this must be a simple table.
sliceds - dataset("10.3")

### Returns:

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

## slices

slices( QDataSet ds, 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 indeces, 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 [view source]

## 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.
[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 [view source]

## sort

sort( QDataSet ds ) → QDataSet

returns a rank 1 dataset of indeces 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 indeces 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 [view source]

## 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 QDataSet

### 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 [view source]
sqrt( Object ds1 ) → QDataSet [view source]

## 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

### Parameters

o - an Object

### Returns:

org.das2.qds.QDataSet
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## stddev

stddev( QDataSet ds ) → QDataSet

standard deviation function.

### Parameters

ds - 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]

## 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

strarr( int len0, int len1 ) → QDataSet

return a rank 2 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 in the first index.
len1 - the number of elements in the second index.

### Returns:

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

### See Also:

dblarr(int)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## 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 indeces.

### 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

subtract( Object ds1, Object ds2 ) → QDataSet

subtract one dataset from another, using dataset to convert the arguments.

### Parameters

ds1 - QDataSet, array, string, scalar argument
ds2 - QDataSet, array, string, scalar argument with compatible geometry

### Returns:

the element-wise difference of the two datasets.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## 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...)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## synchronize

synchronize( QDataSet dsTarget, QDataSet[] dsSources ) → java.util.List

The first dataset's timetags are used to synchronize the list of datasets 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. Note in the case where dsTarget is the set of timeTags, then it must be monotonic. (TODO: why?)

### Parameters

dsTarget - the dataset providing timetags, or the timetags themselves.
dsSources - the N datasets to synch up, where each should have monotonic timetags.

### Returns:

a list of N datasets, synchronized

### See Also:

synchronizeNN(QDataSet, QDataSet...)
synchronize(QDataSet, QDataSet)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## 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...)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## synchronizeNN

synchronizeNN( QDataSet ds1, QDataSet[] dss ) → java.util.List

The first dataset's timetags are used to synchronize the list of datasets 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.

### Parameters

ds1 - the dataset providing timetags, or the timetags themselves.
dss - the N datasets, each either rank 1 or rank 2, all should have DEPEND_0 which is monotonic.

### Returns:

a list of N datasets, synchronized

### See Also:

synchronize(QDataSet, QDataSet...)
synchronizeNN(QDataSet, QDataSet)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## 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]