bidsbuilder.schema.interpreter.evaluation_funcs

allequal(a, b)

true if arrays have the same length and paired elements are equal

#the given example is taken frfom the schema at v1.10.0 and is not clear as it uses the wrong function…

intersects(dataset.modalities, [“pet”, “mri”])

True if either PET or MRI data is found in dataset

#my interpretation represents the first line describing functionality rather than the example

Return type:

bool

Parameters:
  • a (list)

  • b (list)

count(arg, val)

Number of elements in an array equal to val

count(columns.type, “EEG”)

The number of times “EEG” appears in the column “type” of the current TSV file

Return type:

int

Parameters:
  • arg (list)

  • val (Any)

exists(core, arg, rule, add_callbacks=False)

Count of files in an array that exist in the dataset. String is array with length 1. See following section for the meanings of rules.

exists(sidecar.IntendedFor, “subject”)

True if all files in IntendedFor exist, relative to the subject directory.

Return type:

int

Parameters:
  • core (DatasetCore)

  • arg (str | list)

  • rule (str)

  • add_callbacks (bool)

index(arg, val)

Index of first element in an array equal to val, null if not found

index([“i”, “j”, “k”], axis)

The number, from 0-2 corresponding to the string axis

Return type:

int

Parameters:
  • arg (list)

  • val (Any)

intersects(a, b)

The intersection of arrays a and b, or false if there are no shared values.

intersects(dataset.modalities, [“pet”, “mri”])

Non-empty array if either PET or MRI data is found in dataset, otherwise false

Return type:

Union[list, bool]

Parameters:
  • a (list)

  • b (list)

length(arg)

Number of elements in an array

length(columns.onset) > 0

True if there is at least one value in the onset column

Return type:

int

Parameters:

arg (list)

max(arg)

The largest non-n/a value in an array

max(columns.onset)

The time of the last onset in an events.tsv file

Return type:

int

Parameters:

arg (list)

min(arg)

The smallest non-n/a value in an array

min(sidecar.SliceTiming) == 0

A check that the onset of the first slice is 0s

Return type:

int

Parameters:

arg (list)

nMatch(arg, pattern)

true if arg matches the regular expression pattern (anywhere in string)

match(extension, “.gz$”)

True if the file extension ends with .gz

Return type:

bool

Parameters:
  • arg (str)

  • pattern (str)

nSorted(arg, method=None)

The sorted values of the input array; defaults to type-determined sort. If method is “lexical”, or “numeric” use lexical or numeric sort.

sorted(sidecar.VolumeTiming) == sidecar.VolumeTiming

True if sidecar.VolumeTiming is sorted

Return type:

list

Parameters:
  • arg (list)

  • method (str)

nType(arg)

The name of the type, including “array”, “object”, “null”

type(datatypes)

Returns “array”

Return type:

str

Parameters:

arg (Any)

substr(arg, start, end)

The portion of the input string spanning from start position to end position

substr(path, 0, length(path) - 3)

path with the last three characters dropped

Return type:

str

Parameters:
  • arg (str)

  • start (int)

  • end (int)