SDDSlib
Loading...
Searching...
No Matches
sddsdatamodule.c File Reference

Python C extension module (sddsdata) for interfacing with the C language SDDS library. More...

#include <Python.h>
#include "SDDS.h"

Go to the source code of this file.

Classes

struct  module_state
 

Macros

#define PyInt_AsUnsignedLongLong   PyInt_AsUnsignedLongLongMask
 
#define PyInt_AsUnsignedLong   PyInt_AsUnsignedLongMask
 
#define PyInt_AsLongLong   PyInt_AsLong
 
#define GETSTATE(m)
 
#define INITERROR   return
 

Functions

static PyObject * sddsdata_InitializeInput (PyObject *self, PyObject *args)
 Initializes an SDDS dataset for input from a file.
 
static PyObject * sddsdata_InitializeAppend (PyObject *self, PyObject *args)
 Initializes an SDDS dataset for appending data to a file.
 
static PyObject * sddsdata_InitializeAppendToPage (PyObject *self, PyObject *args)
 Initializes appending data to an existing SDDS page in a file.
 
static PyObject * sddsdata_InitializeOutput (PyObject *self, PyObject *args)
 Initializes an SDDS dataset for output to a file.
 
static PyObject * sddsdata_SetColumnMajorOrder (PyObject *self, PyObject *args)
 Sets the data order for the SDDS dataset to column-major.
 
static PyObject * sddsdata_SetFixedRowCountMode (PyObject *self, PyObject *args)
 Sets the row count mode for an SDDS dataset to fixed row count mode.
 
static PyObject * sddsdata_SetRowMajorOrder (PyObject *self, PyObject *args)
 Sets the data order for the SDDS dataset to row-major.
 
static PyObject * sddsdata_EnableFSync (PyObject *self, PyObject *args)
 Enables filesystem synchronization (fsync) for an SDDS dataset.
 
static PyObject * sddsdata_DisableFSync (PyObject *self, PyObject *args)
 Disables filesystem synchronization (fsync) for an SDDS dataset.
 
static PyObject * sddsdata_Terminate (PyObject *self, PyObject *args)
 Terminates an SDDS dataset, releasing any associated resources.
 
static PyObject * sddsdata_SetTerminateMode (PyObject *self, PyObject *args)
 Sets the termination mode for SDDS to avoid freeing strings in arrays and tables.
 
static PyObject * sddsdata_DefineParameter (PyObject *self, PyObject *args)
 Defines a parameter in an SDDS dataset.
 
static PyObject * sddsdata_DefineArray (PyObject *self, PyObject *args)
 Defines an array in an SDDS dataset.
 
static PyObject * sddsdata_DefineColumn (PyObject *self, PyObject *args)
 Defines a column in an SDDS dataset.
 
static PyObject * sddsdata_IsValidName (PyObject *self, PyObject *args)
 Validates a name for SDDS compatibility.
 
static PyObject * sddsdata_SetNameValidityFlags (PyObject *self, PyObject *args)
 Sets name validity flags to allow any name.
 
static PyObject * sddsdata_DefineSimpleColumn (PyObject *self, PyObject *args)
 Defines a simple column in an SDDS dataset.
 
static PyObject * sddsdata_DefineSimpleArray (PyObject *self, PyObject *args)
 Defines a simple array in an SDDS dataset.
 
static PyObject * sddsdata_DefineSimpleParameter (PyObject *self, PyObject *args)
 Defines a simple parameter in an SDDS dataset.
 
static PyObject * sddsdata_WriteLayout (PyObject *self, PyObject *args)
 Writes the layout of an SDDS dataset.
 
static PyObject * sddsdata_EraseData (PyObject *self, PyObject *args)
 Erases data from an SDDS dataset.
 
static PyObject * sddsdata_ProcessColumnString (PyObject *self, PyObject *args)
 Processes a column definition string.
 
static PyObject * sddsdata_ProcessArrayString (PyObject *self, PyObject *args)
 Processes an array definition string.
 
static PyObject * sddsdata_ProcessParameterString (PyObject *self, PyObject *args)
 Processes a parameter definition string.
 
static PyObject * sddsdata_InitializeCopy (PyObject *self, PyObject *args)
 Initializes a copy from one SDDS dataset to another.
 
static PyObject * sddsdata_CopyLayout (PyObject *self, PyObject *args)
 Copies the layout from one SDDS dataset to another.
 
static PyObject * sddsdata_AppendLayout (PyObject *self, PyObject *args)
 Appends the layout of one SDDS dataset to another.
 
static PyObject * sddsdata_CopyPage (PyObject *self, PyObject *args)
 Copies a page from one SDDS dataset to another.
 
static PyObject * sddsdata_CopyParameters (PyObject *self, PyObject *args)
 Copies parameters from one SDDS dataset to another.
 
static PyObject * sddsdata_CopyArrays (PyObject *self, PyObject *args)
 Copies arrays from one SDDS dataset to another.
 
static PyObject * sddsdata_CopyColumns (PyObject *self, PyObject *args)
 Copies columns from one SDDS dataset to another.
 
static PyObject * sddsdata_CopyRow (PyObject *self, PyObject *args)
 Copies a row from one SDDS dataset to another.
 
static PyObject * sddsdata_CopyRowDirect (PyObject *self, PyObject *args)
 Directly copies a row from one SDDS dataset to another.
 
static PyObject * sddsdata_CopyAdditionalRows (PyObject *self, PyObject *args)
 Copies additional rows from one SDDS dataset to another.
 
static PyObject * sddsdata_DeferSavingLayout (PyObject *self, PyObject *args)
 Defers saving the layout of an SDDS dataset.
 
static PyObject * sddsdata_SaveLayout (PyObject *self, PyObject *args)
 Saves the layout of an SDDS dataset.
 
static PyObject * sddsdata_RestoreLayout (PyObject *self, PyObject *args)
 Restores the layout of an SDDS dataset.
 
static PyObject * sddsdata_StartPage (PyObject *self, PyObject *args)
 Starts a page in an SDDS dataset.
 
static PyObject * sddsdata_ClearPage (PyObject *self, PyObject *args)
 Clears the current page in an SDDS dataset.
 
static PyObject * sddsdata_LengthenTable (PyObject *self, PyObject *args)
 Lengthens the table by adding additional rows.
 
static PyObject * sddsdata_WritePage (PyObject *self, PyObject *args)
 Writes the current page of the dataset to the file.
 
static PyObject * sddsdata_UpdatePage (PyObject *self, PyObject *args)
 Updates the page based on the specified mode.
 
static PyObject * sddsdata_InitHeaderlessInput (PyObject *self, PyObject *args)
 Initializes a headerless input for a dataset file.
 
static PyObject * sddsdata_ReadPage (PyObject *self, PyObject *args)
 Reads the current page from the dataset file.
 
static PyObject * sddsdata_ReadPageSparse (PyObject *self, PyObject *args)
 Reads a sparse page from the dataset file.
 
static PyObject * sddsdata_ReadPageLastRows (PyObject *self, PyObject *args)
 Reads the last rows of the current page from the dataset file.
 
static PyObject * sddsdata_RowCount (PyObject *self, PyObject *args)
 Gets the number of rows in the dataset.
 
static PyObject * sddsdata_SetColumnFlags (PyObject *self, PyObject *args)
 Sets the column flags for the dataset.
 
static PyObject * sddsdata_SetRowFlags (PyObject *self, PyObject *args)
 Sets the row flags for the dataset.
 
static PyObject * sddsdata_GetRowFlag (PyObject *self, PyObject *args)
 Gets the flag value for a specific row in the dataset.
 
static PyObject * sddsdata_DeleteColumn (PyObject *self, PyObject *args)
 Deletes a column from the dataset.
 
static PyObject * sddsdata_DeleteParameter (PyObject *self, PyObject *args)
 Deletes a parameter from the dataset.
 
static PyObject * sddsdata_DeleteUnsetColumns (PyObject *self, PyObject *args)
 Deletes all unset columns in the dataset.
 
static PyObject * sddsdata_DeleteUnsetRows (PyObject *self, PyObject *args)
 Deletes all unset rows in the dataset.
 
static PyObject * sddsdata_ColumnCount (PyObject *self, PyObject *args)
 Gets the count of columns in the dataset.
 
static PyObject * sddsdata_ArrayCount (PyObject *self, PyObject *args)
 Gets the count of arrays in the dataset.
 
static PyObject * sddsdata_ParameterCount (PyObject *self, PyObject *args)
 Gets the count of parameters in the dataset.
 
static PyObject * sddsdata_GetDescription (PyObject *self, PyObject *args)
 Gets the description (text and contents) of the dataset.
 
static PyObject * sddsdata_GetDescriptionText (PyObject *self, PyObject *args)
 Retrieves the description text for a dataset.
 
static PyObject * sddsdata_GetDescriptionContents (PyObject *self, PyObject *args)
 Retrieves the description contents for a dataset.
 
static PyObject * sddsdata_NumberOfErrors (PyObject *self, PyObject *args)
 Returns the number of errors recorded.
 
static PyObject * sddsdata_ClearErrors (PyObject *self, PyObject *args)
 Clears all recorded errors.
 
static PyObject * sddsdata_SetError (PyObject *self, PyObject *args)
 Sets an error description.
 
static PyObject * sddsdata_Bomb (PyObject *self, PyObject *args)
 Displays a message on stderr and exits the program.
 
static PyObject * sddsdata_Warning (PyObject *self, PyObject *args)
 Displays a warning message on stderr.
 
static PyObject * sddsdata_RegisterProgramName (PyObject *self, PyObject *args)
 Registers a program name for use in error messages.
 
static PyObject * sddsdata_PrintErrors (PyObject *self, PyObject *args)
 Prints error messages based on the provided mode.
 
static PyObject * sddsdata_TransferColumnDefinition (PyObject *self, PyObject *args)
 Transfers a column definition from one dataset to another.
 
static PyObject * sddsdata_TransferArrayDefinition (PyObject *self, PyObject *args)
 Transfers an array definition from one dataset to another.
 
static PyObject * sddsdata_TransferParameterDefinition (PyObject *self, PyObject *args)
 Transfers a parameter definition from one dataset to another.
 
static PyObject * sddsdata_DefineColumnLikeParameter (PyObject *self, PyObject *args)
 Defines a column in one dataset based on a parameter in another dataset.
 
static PyObject * sddsdata_DefineParameterLikeColumn (PyObject *self, PyObject *args)
 Defines a parameter in one dataset based on a column in another dataset.
 
static PyObject * sddsdata_TransferAllColumnDefinitions (PyObject *self, PyObject *args)
 Transfers all column definitions from one dataset to another.
 
static PyObject * sddsdata_TransferAllArrayDefinitions (PyObject *self, PyObject *args)
 Transfers all array definitions from one dataset to another.
 
static PyObject * sddsdata_TransferAllParameterDefinitions (PyObject *self, PyObject *args)
 Transfers all parameter definitions from one dataset to another.
 
static PyObject * sddsdata_GetColumnIndex (PyObject *self, PyObject *args)
 Retrieves the index of a column in a dataset.
 
static PyObject * sddsdata_GetArrayIndex (PyObject *self, PyObject *args)
 Retrieves the index of an array in a dataset.
 
static PyObject * sddsdata_GetParameterIndex (PyObject *self, PyObject *args)
 Retrieves the index of a parameter in a dataset.
 
static PyObject * sddsdata_GetColumnType (PyObject *self, PyObject *args)
 Retrieves the type of a column in a dataset.
 
static PyObject * sddsdata_GetArrayType (PyObject *self, PyObject *args)
 Retrieves the type of an array in a dataset.
 
static PyObject * sddsdata_GetNamedColumnType (PyObject *self, PyObject *args)
 Retrieves the type of a column by name in a dataset.
 
static PyObject * sddsdata_GetNamedArrayType (PyObject *self, PyObject *args)
 Retrieves the type of an array by name in a dataset.
 
static PyObject * sddsdata_GetColumnDefinition (PyObject *self, PyObject *args)
 Retrieves the definition of a column in a dataset.
 
static PyObject * sddsdata_GetArrayDefinition (PyObject *self, PyObject *args)
 Retrieves the definition of an array in a dataset.
 
static PyObject * sddsdata_GetParameterType (PyObject *self, PyObject *args)
 Retrieves the type of a parameter in a dataset.
 
static PyObject * sddsdata_GetNamedParameterType (PyObject *self, PyObject *args)
 Retrieves the type of a parameter by name in a dataset.
 
static PyObject * sddsdata_GetParameterDefinition (PyObject *self, PyObject *args)
 Retrieves the definition of a parameter in a dataset.
 
static PyObject * sddsdata_GetTypeSize (PyObject *self, PyObject *args)
 Retrieves the size of a given SDDS data type.
 
static PyObject * sddsdata_GetTypeName (PyObject *self, PyObject *args)
 Retrieves the name of a given SDDS data type.
 
static PyObject * sddsdata_IdentifyType (PyObject *self, PyObject *args)
 Identifies the SDDS data type for a given type name.
 
static PyObject * sddsdata_CheckColumn (PyObject *self, PyObject *args)
 Verifies the existence and type of a column in a dataset.
 
static PyObject * sddsdata_CheckArray (PyObject *self, PyObject *args)
 Verifies the existence and type of an array in a dataset.
 
static PyObject * sddsdata_CheckParameter (PyObject *self, PyObject *args)
 Verifies the existence and type of a parameter in a dataset.
 
static PyObject * sddsdata_HasWhitespace (PyObject *self, PyObject *args)
 Determines if a string contains whitespace.
 
static PyObject * sddsdata_StringIsBlank (PyObject *self, PyObject *args)
 Checks if a string is blank.
 
static PyObject * sddsdata_ApplyFactorToParameter (PyObject *self, PyObject *args)
 Applies a scaling factor to a parameter in a dataset.
 
static PyObject * sddsdata_ApplyFactorToColumn (PyObject *self, PyObject *args)
 Applies a scaling factor to a column in a dataset.
 
static PyObject * sddsdata_DeleteParameterFixedValues (PyObject *self, PyObject *args)
 Deletes fixed parameter values for a given dataset.
 
static PyObject * sddsdata_SetDataMode (PyObject *self, PyObject *args)
 Sets the data mode for a given dataset.
 
static PyObject * sddsdata_CheckDataset (PyObject *self, PyObject *args)
 Checks the validity of a dataset.
 
static PyObject * sddsdata_SetAutoCheckMode (PyObject *self, PyObject *args)
 Sets the auto-check mode for datasets.
 
static PyObject * sddsdata_GetColumnNameFromIndex (PyObject *self, PyObject *args)
 Retrieves a column name by its index from a dataset.
 
static PyObject * sddsdata_GetColumnNames (PyObject *self, PyObject *args)
 Retrieves all column names from a dataset.
 
static PyObject * sddsdata_GetArrayNameFromIndex (PyObject *self, PyObject *args)
 Retrieves an array name by its index from a dataset.
 
static PyObject * sddsdata_GetArrayNames (PyObject *self, PyObject *args)
 Retrieves all array names from a dataset.
 
static PyObject * sddsdata_GetParameterNameFromIndex (PyObject *self, PyObject *args)
 Retrieves a parameter name by its index from a dataset.
 
static PyObject * sddsdata_GetParameterNames (PyObject *self, PyObject *args)
 Retrieves all parameter names from a dataset.
 
static PyObject * sddsdata_SetParameter (PyObject *self, PyObject *args)
 Sets a parameter value in a dataset by index or name.
 
static PyObject * sddsdata_SetArray (PyObject *self, PyObject *args)
 Sets an array value in a dataset.
 
static PyObject * sddsdata_SetColumn (PyObject *self, PyObject *args)
 Sets a column value in a dataset.
 
static PyObject * sddsdata_SetRowValues (PyObject *self, PyObject *args)
 Sets values for a specific row in a dataset.
 
static PyObject * sddsdata_GetColumn (PyObject *self, PyObject *args)
 Retrieves a column's data from a dataset.
 
static PyObject * sddsdata_GetArray (PyObject *self, PyObject *args)
 Retrieves an array's data from a dataset.
 
static PyObject * sddsdata_GetArrayDimensions (PyObject *self, PyObject *args)
 Retrieves the dimensions of an array in a dataset.
 
static PyObject * sddsdata_GetParameter (PyObject *self, PyObject *args)
 Retrieves the value of a parameter from a dataset.
 
static PyObject * sddsdata_GetMode (PyObject *self, PyObject *args)
 Retrieves the data mode of a dataset.
 
void initsddsdata (void)
 

Variables

SDDS_DATASET dataset_f [20]
 Array of SDDS dataset structures.
 
static struct module_state _state
 
static PyMethodDef sddsdata_methods []
 

Detailed Description

Python C extension module (sddsdata) for interfacing with the C language SDDS library.

This file provides a set of Python bindings to the SDDS library for handling scientific data in the Self-Describing Data Sets (SDDS) format.

Definition in file sddsdatamodule.c.

Macro Definition Documentation

◆ GETSTATE

#define GETSTATE ( m)
Value:
(&_state)

Definition at line 3564 of file sddsdatamodule.c.

◆ INITERROR

#define INITERROR   return

Definition at line 3720 of file sddsdatamodule.c.

◆ PyInt_AsLongLong

#define PyInt_AsLongLong   PyInt_AsLong

Definition at line 26 of file sddsdatamodule.c.

◆ PyInt_AsUnsignedLong

#define PyInt_AsUnsignedLong   PyInt_AsUnsignedLongMask

Definition at line 25 of file sddsdatamodule.c.

◆ PyInt_AsUnsignedLongLong

#define PyInt_AsUnsignedLongLong   PyInt_AsUnsignedLongLongMask

Definition at line 24 of file sddsdatamodule.c.

Function Documentation

◆ initsddsdata()

void initsddsdata ( void )

Definition at line 3727 of file sddsdatamodule.c.

3729{
3730 struct module_state *st;
3731#if PY_MAJOR_VERSION >= 3
3732 PyObject *module = PyModule_Create(&moduledef);
3733#else
3734 PyObject *module = Py_InitModule( "sddsdata", sddsdata_methods );
3735#endif
3736 if (module == NULL)
3737 INITERROR;
3738
3739 st = GETSTATE(module);
3740
3741 st->error = PyErr_NewException("sddsedir.Error", NULL, NULL);
3742 if (st->error == NULL) {
3743 Py_DECREF(module);
3744 INITERROR;
3745 }
3746
3747#if PY_MAJOR_VERSION >= 3
3748 return module;
3749#endif
3750
3751}

◆ sddsdata_AppendLayout()

static PyObject * sddsdata_AppendLayout ( PyObject * self,
PyObject * args )
static

Appends the layout of one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 747 of file sddsdatamodule.c.

748{
749 long fileIndexTarget;
750 long fileIndexSource;
751 if (!PyArg_ParseTuple(args, "ll", &fileIndexTarget, &fileIndexSource)) {
752 return NULL;
753 }
754 return PyLong_FromLong(SDDS_AppendLayout(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], 0));
755}
int32_t SDDS_AppendLayout(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
Definition SDDS_copy.c:158
SDDS_DATASET dataset_f[20]
Array of SDDS dataset structures.

◆ sddsdata_ApplyFactorToColumn()

static PyObject * sddsdata_ApplyFactorToColumn ( PyObject * self,
PyObject * args )
static

Applies a scaling factor to a column in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Column name.
  • factor (double): Scaling factor.
Returns
Python integer (1 on success, 0 on error).

Definition at line 2249 of file sddsdatamodule.c.

2250{
2251 long fileIndex;
2252 char *name;
2253 double factor;
2254 if (!PyArg_ParseTuple(args, "lsd", &fileIndex, &name, &factor)) {
2255 return NULL;
2256 }
2257 return PyLong_FromLong(SDDS_ApplyFactorToColumn(&dataset_f[fileIndex], name, factor));
2258}
int32_t SDDS_ApplyFactorToColumn(SDDS_DATASET *SDDS_dataset, char *name, double factor)
Applies a scaling factor to all elements of a specific column in the SDDS dataset.

◆ sddsdata_ApplyFactorToParameter()

static PyObject * sddsdata_ApplyFactorToParameter ( PyObject * self,
PyObject * args )
static

Applies a scaling factor to a parameter in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Parameter name.
  • factor (double): Scaling factor.
Returns
Python integer (1 on success, 0 on error).

Definition at line 2228 of file sddsdatamodule.c.

2229{
2230 long fileIndex;
2231 char *name;
2232 double factor;
2233 if (!PyArg_ParseTuple(args, "lsd", &fileIndex, &name, &factor)) {
2234 return NULL;
2235 }
2236 return PyLong_FromLong(SDDS_ApplyFactorToParameter(&dataset_f[fileIndex], name, factor));
2237}
int32_t SDDS_ApplyFactorToParameter(SDDS_DATASET *SDDS_dataset, char *name, double factor)
Applies a scaling factor to a specific parameter in the SDDS dataset.

◆ sddsdata_ArrayCount()

static PyObject * sddsdata_ArrayCount ( PyObject * self,
PyObject * args )
static

Gets the count of arrays in the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
PyObject*: Number of arrays as PyLong.

Definition at line 1327 of file sddsdatamodule.c.

1328{
1329 long fileIndex;
1330 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1331 return NULL;
1332 }
1333 return PyLong_FromLong(SDDS_ArrayCount(&dataset_f[fileIndex]));
1334}
int32_t SDDS_ArrayCount(SDDS_DATASET *page)
Retrieves the number of arrays in the SDDS dataset.

◆ sddsdata_Bomb()

static PyObject * sddsdata_Bomb ( PyObject * self,
PyObject * args )
static

Displays a message on stderr and exits the program.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • message (char*): Message to display.
Returns
Python None, or NULL on error.

Definition at line 1491 of file sddsdatamodule.c.

1492{
1493 char *message;
1494 if (!PyArg_ParseTuple(args, "s", &message)) {
1495 return NULL;
1496 }
1497 SDDS_Bomb(message);
1498 Py_INCREF(Py_None);
1499 return Py_None;
1500}
void SDDS_Bomb(char *message)
Terminates the program after printing an error message and recorded errors.
Definition SDDS_utils.c:342

◆ sddsdata_CheckArray()

static PyObject * sddsdata_CheckArray ( PyObject * self,
PyObject * args )
static

Verifies the existence and type of an array in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Array name.
  • units (char*): Expected units.
  • type (long): Expected type.
Returns
Python integer indicating the check status.

Definition at line 2149 of file sddsdatamodule.c.

2150{
2151 long fileIndex;
2152 char *name;
2153 char *units;
2154 long type;
2155 if (!PyArg_ParseTuple(args, "lssl", &fileIndex, &name, &units, &type)) {
2156 return NULL;
2157 }
2158 return PyLong_FromLong(SDDS_CheckArray(&dataset_f[fileIndex], name, units, type, stderr));
2159}
int32_t SDDS_CheckArray(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if an array exists in the SDDS dataset with the specified name, units, and type.

◆ sddsdata_CheckColumn()

static PyObject * sddsdata_CheckColumn ( PyObject * self,
PyObject * args )
static

Verifies the existence and type of a column in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Column name.
  • units (char*): Expected units.
  • type (long): Expected type.
Returns
Python integer indicating the check status.

Definition at line 2126 of file sddsdatamodule.c.

2127{
2128 long fileIndex;
2129 char *name;
2130 char *units;
2131 long type;
2132 if (!PyArg_ParseTuple(args, "lssl", &fileIndex, &name, &units, &type)) {
2133 return NULL;
2134 }
2135 return PyLong_FromLong(SDDS_CheckColumn(&dataset_f[fileIndex], name, units, type, stderr));
2136}
int32_t SDDS_CheckColumn(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if a column exists in the SDDS dataset with the specified name, units, and type.

◆ sddsdata_CheckDataset()

static PyObject * sddsdata_CheckDataset ( PyObject * self,
PyObject * args )
static

Checks the validity of a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • caller: Caller information string.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 2314 of file sddsdatamodule.c.

2315{
2316 long fileIndex;
2317 char *caller;
2318 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &caller)) {
2319 return NULL;
2320 }
2321 return PyLong_FromLong(SDDS_CheckDataset(&dataset_f[fileIndex], caller));
2322}
int32_t SDDS_CheckDataset(SDDS_DATASET *SDDS_dataset, const char *caller)
Validates the SDDS dataset pointer.
Definition SDDS_utils.c:552

◆ sddsdata_CheckParameter()

static PyObject * sddsdata_CheckParameter ( PyObject * self,
PyObject * args )
static

Verifies the existence and type of a parameter in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Parameter name.
  • units (char*): Expected units.
  • type (long): Expected type.
Returns
Python integer indicating the check status.

Definition at line 2172 of file sddsdatamodule.c.

2173{
2174 long fileIndex;
2175 char *name;
2176 char *units;
2177 long type;
2178 if (!PyArg_ParseTuple(args, "lssl", &fileIndex, &name, &units, &type)) {
2179 return NULL;
2180 }
2181 return PyLong_FromLong(SDDS_CheckParameter(&dataset_f[fileIndex], name, units, type, stderr));
2182}
int32_t SDDS_CheckParameter(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if a parameter exists in the SDDS dataset with the specified name, units, and type.

◆ sddsdata_ClearErrors()

static PyObject * sddsdata_ClearErrors ( PyObject * self,
PyObject * args )
static

Clears all recorded errors.

Parameters
selfPython object (unused).
argsPython tuple (unused).
Returns
Python None.

Definition at line 1457 of file sddsdatamodule.c.

1458{
1460 Py_INCREF(Py_None);
1461 return Py_None;
1462}
void SDDS_ClearErrors()
Clears all recorded error messages from the SDDS error stack.
Definition SDDS_utils.c:318

◆ sddsdata_ClearPage()

static PyObject * sddsdata_ClearPage ( PyObject * self,
PyObject * args )
static

Clears the current page in an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 991 of file sddsdatamodule.c.

992{
993 long fileIndex;
994 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
995 return NULL;
996 }
997 return PyLong_FromLong(SDDS_ClearPage(&dataset_f[fileIndex]));
998}
int32_t SDDS_ClearPage(SDDS_DATASET *SDDS_dataset)

◆ sddsdata_ColumnCount()

static PyObject * sddsdata_ColumnCount ( PyObject * self,
PyObject * args )
static

Gets the count of columns in the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
PyObject*: Number of columns as PyLong.

Definition at line 1311 of file sddsdatamodule.c.

1312{
1313 long fileIndex;
1314 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1315 return NULL;
1316 }
1317 return PyLong_FromLong(SDDS_ColumnCount(&dataset_f[fileIndex]));
1318}
int32_t SDDS_ColumnCount(SDDS_DATASET *page)
Retrieves the number of columns in the SDDS dataset.

◆ sddsdata_CopyAdditionalRows()

static PyObject * sddsdata_CopyAdditionalRows ( PyObject * self,
PyObject * args )
static

Copies additional rows from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 895 of file sddsdatamodule.c.

896{
897 long fileIndexTarget;
898 long fileIndexSource;
899 if (!PyArg_ParseTuple(args, "ll", &fileIndexTarget, &fileIndexSource)) {
900 return NULL;
901 }
902 return PyLong_FromLong(SDDS_CopyAdditionalRows(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource]));
903}
int32_t SDDS_CopyAdditionalRows(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
Definition SDDS_copy.c:519

◆ sddsdata_CopyArrays()

static PyObject * sddsdata_CopyArrays ( PyObject * self,
PyObject * args )
static

Copies arrays from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 807 of file sddsdatamodule.c.

808{
809 long fileIndexTarget;
810 long fileIndexSource;
811 if (!PyArg_ParseTuple(args, "ll", &fileIndexTarget, &fileIndexSource)) {
812 return NULL;
813 }
814 return PyLong_FromLong(SDDS_CopyArrays(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource]));
815}
int32_t SDDS_CopyArrays(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
Definition SDDS_copy.c:334

◆ sddsdata_CopyColumns()

static PyObject * sddsdata_CopyColumns ( PyObject * self,
PyObject * args )
static

Copies columns from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 827 of file sddsdatamodule.c.

828{
829 long fileIndexTarget;
830 long fileIndexSource;
831 if (!PyArg_ParseTuple(args, "ll", &fileIndexTarget, &fileIndexSource)) {
832 return NULL;
833 }
834 return PyLong_FromLong(SDDS_CopyColumns(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource]));
835}
int32_t SDDS_CopyColumns(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
Definition SDDS_copy.c:387

◆ sddsdata_CopyLayout()

static PyObject * sddsdata_CopyLayout ( PyObject * self,
PyObject * args )
static

Copies the layout from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 727 of file sddsdatamodule.c.

728{
729 long fileIndexTarget;
730 long fileIndexSource;
731 if (!PyArg_ParseTuple(args, "ll", &fileIndexTarget, &fileIndexSource)) {
732 return NULL;
733 }
734 return PyLong_FromLong(SDDS_CopyLayout(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource]));
735}
int32_t SDDS_CopyLayout(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
Definition SDDS_copy.c:222

◆ sddsdata_CopyPage()

static PyObject * sddsdata_CopyPage ( PyObject * self,
PyObject * args )
static

Copies a page from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 767 of file sddsdatamodule.c.

768{
769 long fileIndexTarget;
770 long fileIndexSource;
771 if (!PyArg_ParseTuple(args, "ll", &fileIndexTarget, &fileIndexSource)) {
772 return NULL;
773 }
774 return PyLong_FromLong(SDDS_CopyPage(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource]));
775}
int32_t SDDS_CopyPage(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
Definition SDDS_copy.c:578

◆ sddsdata_CopyParameters()

static PyObject * sddsdata_CopyParameters ( PyObject * self,
PyObject * args )
static

Copies parameters from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 787 of file sddsdatamodule.c.

788{
789 long fileIndexTarget;
790 long fileIndexSource;
791 if (!PyArg_ParseTuple(args, "ll", &fileIndexTarget, &fileIndexSource)) {
792 return NULL;
793 }
794 return PyLong_FromLong(SDDS_CopyParameters(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource]));
795}
int32_t SDDS_CopyParameters(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
Definition SDDS_copy.c:286

◆ sddsdata_CopyRow()

static PyObject * sddsdata_CopyRow ( PyObject * self,
PyObject * args )
static

Copies a row from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • target_row (long): Row number in the target dataset.
  • fileIndexSource (long): Index of the source dataset.
  • source_row (long): Row number in the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 849 of file sddsdatamodule.c.

850{
851 long fileIndexTarget;
852 long target_row;
853 long fileIndexSource;
854 long source_row;
855 if (!PyArg_ParseTuple(args, "llll", &fileIndexTarget, &target_row, &fileIndexSource, &source_row)) {
856 return NULL;
857 }
858 return PyLong_FromLong(SDDS_CopyRow(&dataset_f[fileIndexTarget], target_row, &dataset_f[fileIndexSource], source_row));
859}
int32_t SDDS_CopyRow(SDDS_DATASET *SDDS_target, int64_t target_row, SDDS_DATASET *SDDS_source, int64_t source_srow)
Definition SDDS_copy.c:778

◆ sddsdata_CopyRowDirect()

static PyObject * sddsdata_CopyRowDirect ( PyObject * self,
PyObject * args )
static

Directly copies a row from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • target_row (long): Row number in the target dataset.
  • fileIndexSource (long): Index of the source dataset.
  • source_row (long): Row number in the source dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 873 of file sddsdatamodule.c.

874{
875 long fileIndexTarget;
876 long target_row;
877 long fileIndexSource;
878 long source_row;
879 if (!PyArg_ParseTuple(args, "llll", &fileIndexTarget, &target_row, &fileIndexSource, &source_row)) {
880 return NULL;
881 }
882 return PyLong_FromLong(SDDS_CopyRowDirect(&dataset_f[fileIndexTarget], target_row, &dataset_f[fileIndexSource], source_row));
883}
int32_t SDDS_CopyRowDirect(SDDS_DATASET *SDDS_target, int64_t target_row, SDDS_DATASET *SDDS_source, int64_t source_row)
Definition SDDS_copy.c:834

◆ sddsdata_DeferSavingLayout()

static PyObject * sddsdata_DeferSavingLayout ( PyObject * self,
PyObject * args )
static

Defers saving the layout of an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • mode (long): Mode for deferring (0 for False, 1 for True).
Returns
PyObject* None.

Definition at line 915 of file sddsdatamodule.c.

916{
917 long fileIndex, mode;
918 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &mode)) {
919 return NULL;
920 }
921 SDDS_DeferSavingLayout(&dataset_f[fileIndex],mode);
922 Py_INCREF(Py_None);
923 return Py_None;
924}
void SDDS_DeferSavingLayout(SDDS_DATASET *SDDS_dataset, int32_t mode)
Definition SDDS_copy.c:603

◆ sddsdata_DefineArray()

static PyObject * sddsdata_DefineArray ( PyObject * self,
PyObject * args )
static

Defines an array in an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • name (char*): Name of the array.
  • symbol (char*): Symbol for the array.
  • units (char*): Units of the array.
  • description (char*): Description of the array.
  • format_string (char*): Format string for the array.
  • type (long): Data type of the array.
  • field_length (long): Length of the fields in the array.
  • dimensions (long): Number of dimensions in the array.
  • group_name (char*): Name of the group to which the array belongs.
Returns
PyObject* A Python integer representing the index of the array on success or -1 on error.

Definition at line 391 of file sddsdatamodule.c.

392{
393 long fileIndex;
394 char *name;
395 char *symbol;
396 char *units;
397 char *description;
398 char *format_string;
399 long type;
400 long field_length;
401 long dimensions;
402 char *group_name;
403 if (!PyArg_ParseTuple(args, "lsssssslll", &fileIndex, &name , &symbol, &units, &description, &format_string, &group_name, &type, &field_length, &dimensions)) {
404 return NULL;
405 }
406 if (symbol)
407 if (strlen(symbol) == 0)
408 symbol = NULL;
409 if (units)
410 if (strlen(units) == 0)
411 units = NULL;
412 if (description)
413 if (strlen(description) == 0)
414 description = NULL;
415 if (format_string)
416 if (strlen(format_string) == 0)
417 format_string = NULL;
418 if (group_name)
419 if (strlen(group_name) == 0)
420 group_name = NULL;
421 return PyLong_FromLong(SDDS_DefineArray(&dataset_f[fileIndex], name, symbol, units, description, format_string, type, field_length, dimensions, group_name));
422}
int32_t SDDS_DefineArray(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, int32_t field_length, int32_t dimensions, const char *group_name)
Defines a data array within the SDDS dataset.

◆ sddsdata_DefineColumn()

static PyObject * sddsdata_DefineColumn ( PyObject * self,
PyObject * args )
static

Defines a column in an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • name (char*): Name of the column.
  • symbol (char*): Symbol for the column.
  • units (char*): Units of the column.
  • description (char*): Description of the column.
  • format_string (char*): Format string for the column.
  • type (long): Data type of the column.
  • field_length (long): Length of the fields in the column.
Returns
PyObject* A Python integer representing the index of the column on success or -1 on error.

Definition at line 440 of file sddsdatamodule.c.

441{
442 long fileIndex;
443 char *name;
444 char *symbol;
445 char *units;
446 char *description;
447 char *format_string;
448 long type;
449 long field_length;
450 if (!PyArg_ParseTuple(args, "lsssssll", &fileIndex, &name , &symbol, &units, &description, &format_string, &type, &field_length)) {
451 return NULL;
452 }
453 if (symbol)
454 if (strlen(symbol) == 0)
455 symbol = NULL;
456 if (units)
457 if (strlen(units) == 0)
458 units = NULL;
459 if (description)
460 if (strlen(description) == 0)
461 description = NULL;
462 if (format_string)
463 if (strlen(format_string) == 0)
464 format_string = NULL;
465 return PyLong_FromLong(SDDS_DefineColumn(&dataset_f[fileIndex], name, symbol, units, description, format_string, type, field_length));
466}
int32_t SDDS_DefineColumn(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, int32_t field_length)
Defines a data column within the SDDS dataset.

◆ sddsdata_DefineColumnLikeParameter()

static PyObject * sddsdata_DefineColumnLikeParameter ( PyObject * self,
PyObject * args )
static

Defines a column in one dataset based on a parameter in another dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • name (char*): Name of the parameter to base the column on.
  • newName (char*): New name for the column (optional).
Returns
Python integer (1 on success, 0 on error).

Definition at line 1639 of file sddsdatamodule.c.

1640{
1641 long fileIndexTarget;
1642 long fileIndexSource;
1643 char *name;
1644 char *newName;
1645 if (!PyArg_ParseTuple(args, "llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1646 return NULL;
1647 }
1648 return PyLong_FromLong(SDDS_DefineColumnLikeParameter(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], name, newName));
1649}
int32_t SDDS_DefineColumnLikeParameter(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Defines a column in the target dataset based on a parameter definition from the source dataset.

◆ sddsdata_DefineParameter()

static PyObject * sddsdata_DefineParameter ( PyObject * self,
PyObject * args )
static

Defines a parameter in an SDDS dataset.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
  • name (char*): Name of the parameter.
  • symbol (char*): Symbol for the parameter (optional).
  • units (char*): Units of the parameter (optional).
  • description (char*): Description of the parameter (optional).
  • format_string (char*): Format string for displaying the parameter (optional).
  • type (long): Data type of the parameter (e.g., SDDS_LONG, SDDS_DOUBLE).
  • fixed_value (PyObject*): Fixed value for the parameter.
Returns
PyObject*
  • Index of the defined parameter on success.
  • -1 on error.

Definition at line 302 of file sddsdatamodule.c.

303{
304 long fileIndex;
305 char *name;
306 char *symbol;
307 char *units;
308 char *description;
309 char *format_string;
310 long type;
311 PyObject *fixed_value;
312 char *fixedStringValue;
313 int32_t fixedLongValue;
314 double fixedDoubleValue;
315 char buffer[SDDS_MAXLINE];
316 if (!PyArg_ParseTuple(args, "lssssslO", &fileIndex, &name , &symbol , &units , &description , &format_string , &type , &fixed_value)) {
317 return NULL;
318 }
319 if (symbol)
320 if (strlen(symbol) == 0)
321 symbol = NULL;
322 if (units)
323 if (strlen(units) == 0)
324 units = NULL;
325 if (description)
326 if (strlen(description) == 0)
327 description = NULL;
328 if (format_string)
329 if (strlen(format_string) == 0)
330 format_string = NULL;
331
332 if (PyString_Check(fixed_value)) {
333 fixedStringValue = PyString_AsString(fixed_value);
334 if (fixedStringValue)
335 if (strlen(fixedStringValue) == 0)
336 fixedStringValue = NULL;
337 return PyLong_FromLong(SDDS_DefineParameter(&dataset_f[fileIndex],
338 name, symbol, units,
339 description, format_string,
340 type, fixedStringValue));
341 } else {
342 if (PyNumber_Check(fixed_value)) {
343 if (PyLong_Check(fixed_value)) {
344 fixedLongValue = (int32_t)PyLong_AsLong(fixed_value);
345 SDDS_SprintTypedValue(&fixedLongValue, 0, SDDS_LONG , format_string, buffer, 0);
346 return PyLong_FromLong(SDDS_DefineParameter(&dataset_f[fileIndex],
347 name, symbol, units,
348 description, format_string,
349 type, buffer));
350 } else if (PyInt_Check(fixed_value)) {
351 fixedLongValue = (int32_t)PyInt_AsLong(fixed_value);
352 SDDS_SprintTypedValue(&fixedLongValue, 0, SDDS_LONG , format_string, buffer, 0);
353 return PyLong_FromLong(SDDS_DefineParameter(&dataset_f[fileIndex],
354 name, symbol, units,
355 description, format_string,
356 type, buffer));
357 } else if (PyFloat_Check(fixed_value)) {
358 fixedDoubleValue = PyFloat_AsDouble(fixed_value);
359 SDDS_SprintTypedValue(&fixedDoubleValue, 0, SDDS_DOUBLE , format_string, buffer, 0);
360 return PyLong_FromLong(SDDS_DefineParameter(&dataset_f[fileIndex],
361 name, symbol, units,
362 description, format_string,
363 type, buffer));
364 }
365 }
366 return PyLong_FromLong(SDDS_DefineParameter1(&dataset_f[fileIndex],
367 name, symbol, units,
368 description, format_string,
369 type, NULL));
370 }
371}
int32_t SDDS_DefineParameter1(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, void *fixed_value)
Defines a data parameter with a fixed numerical value.
int32_t SDDS_DefineParameter(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, char *fixed_value)
Defines a data parameter with a fixed string value.
int32_t SDDS_SprintTypedValue(void *data, int64_t index, int32_t type, const char *format, char *buffer, uint32_t mode)
Formats a data value of a specified type into a string buffer using an optional printf format string.
Definition SDDS_utils.c:151
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.
Definition SDDStypes.h:61
#define SDDS_DOUBLE
Identifier for the double data type.
Definition SDDStypes.h:37

◆ sddsdata_DefineParameterLikeColumn()

static PyObject * sddsdata_DefineParameterLikeColumn ( PyObject * self,
PyObject * args )
static

Defines a parameter in one dataset based on a column in another dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • name (char*): Name of the column to base the parameter on.
  • newName (char*): New name for the parameter (optional).
Returns
Python integer (1 on success, 0 on error).

Definition at line 1662 of file sddsdatamodule.c.

1663{
1664 long fileIndexTarget;
1665 long fileIndexSource;
1666 char *name;
1667 char *newName;
1668 if (!PyArg_ParseTuple(args, "llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1669 return NULL;
1670 }
1671 return PyLong_FromLong(SDDS_DefineParameterLikeColumn(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], name, newName));
1672}
int32_t SDDS_DefineParameterLikeColumn(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Defines a parameter in the target dataset based on a column definition from the source dataset.

◆ sddsdata_DefineSimpleArray()

static PyObject * sddsdata_DefineSimpleArray ( PyObject * self,
PyObject * args )
static

Defines a simple array in an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • name (char*): Name of the array.
  • units (char*): Units of the array.
  • type (long): Data type of the array.
  • dimensions (long): Number of dimensions in the array.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 539 of file sddsdatamodule.c.

540{
541 long fileIndex;
542 char *name;
543 char *units;
544 long type;
545 long dimensions;
546 long results;
547 if (!PyArg_ParseTuple(args, "lssll", &fileIndex, &name, &units, &type, &dimensions)) {
548 return NULL;
549 }
550 if (units)
551 if (strlen(units) == 0)
552 units = NULL;
553 results = SDDS_DefineArray(&dataset_f[fileIndex], name, NULL, units, NULL, NULL, type, 0, dimensions, NULL);
554 if (results == -1) {
555 results = 0;
556 } else {
557 results = 1;
558 }
559 return PyLong_FromLong(results);
560}

◆ sddsdata_DefineSimpleColumn()

static PyObject * sddsdata_DefineSimpleColumn ( PyObject * self,
PyObject * args )
static

Defines a simple column in an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • name (char*): Name of the column.
  • units (char*): Units of the column.
  • type (long): Data type of the column.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 511 of file sddsdatamodule.c.

512{
513 long fileIndex;
514 char *name;
515 char *units;
516 long type;
517 if (!PyArg_ParseTuple(args, "lssl", &fileIndex, &name, &units, &type)) {
518 return NULL;
519 }
520 if (units)
521 if (strlen(units) == 0)
522 units = NULL;
523 return PyLong_FromLong(SDDS_DefineSimpleColumn(&dataset_f[fileIndex], name, units, type));
524}
int32_t SDDS_DefineSimpleColumn(SDDS_DATASET *SDDS_dataset, const char *name, const char *unit, int32_t type)
Defines a simple data column within the SDDS dataset.

◆ sddsdata_DefineSimpleParameter()

static PyObject * sddsdata_DefineSimpleParameter ( PyObject * self,
PyObject * args )
static

Defines a simple parameter in an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • name (char*): Name of the parameter.
  • units (char*): Units of the parameter.
  • type (long): Data type of the parameter.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 574 of file sddsdatamodule.c.

575{
576 long fileIndex;
577 char *name;
578 char *units;
579 long type;
580 if (!PyArg_ParseTuple(args, "lssl", &fileIndex, &name, &units, &type)) {
581 return NULL;
582 }
583 if (units)
584 if (strlen(units) == 0)
585 units = NULL;
586 return PyLong_FromLong(SDDS_DefineSimpleParameter(&dataset_f[fileIndex], name, units, type));
587}
int32_t SDDS_DefineSimpleParameter(SDDS_DATASET *SDDS_dataset, const char *name, const char *unit, int32_t type)
Defines a simple data parameter within the SDDS dataset.

◆ sddsdata_DeleteColumn()

static PyObject * sddsdata_DeleteColumn ( PyObject * self,
PyObject * args )
static

Deletes a column from the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
  • column_name (char*): Name of the column to delete.
Returns
PyObject*:
  • PyLong(0) on error.
  • PyLong(1) on success.

Definition at line 1238 of file sddsdatamodule.c.

1239{
1240 long fileIndex;
1241 char *column_name;
1242 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &column_name)) {
1243 return NULL;
1244 }
1245 return PyLong_FromLong(SDDS_DeleteColumn(&dataset_f[fileIndex], column_name));
1246}
int32_t SDDS_DeleteColumn(SDDS_DATASET *SDDS_dataset, char *column_name)
Deletes a specified column from an SDDS dataset.

◆ sddsdata_DeleteParameter()

static PyObject * sddsdata_DeleteParameter ( PyObject * self,
PyObject * args )
static

Deletes a parameter from the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
  • parameter_name (char*): Name of the parameter to delete.
Returns
PyObject*:
  • PyLong(0) on error.
  • PyLong(1) on success.

Definition at line 1258 of file sddsdatamodule.c.

1259{
1260 long fileIndex;
1261 char *parameter_name;
1262 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &parameter_name)) {
1263 return NULL;
1264 }
1265 return PyLong_FromLong(SDDS_DeleteParameter(&dataset_f[fileIndex], parameter_name));
1266}
int32_t SDDS_DeleteParameter(SDDS_DATASET *SDDS_dataset, char *parameter_name)
Deletes a specified parameter from an SDDS dataset.

◆ sddsdata_DeleteParameterFixedValues()

static PyObject * sddsdata_DeleteParameterFixedValues ( PyObject * self,
PyObject * args )
static

Deletes fixed parameter values for a given dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 2271 of file sddsdatamodule.c.

2272{
2273 long fileIndex;
2274 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
2275 return NULL;
2276 }
2277 return PyLong_FromLong(SDDS_DeleteParameterFixedValues(&dataset_f[fileIndex]));
2278}
int32_t SDDS_DeleteParameterFixedValues(SDDS_DATASET *SDDS_dataset)
Deletes fixed values from all parameters in the SDDS dataset.

◆ sddsdata_DeleteUnsetColumns()

static PyObject * sddsdata_DeleteUnsetColumns ( PyObject * self,
PyObject * args )
static

Deletes all unset columns in the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
PyObject*:
  • PyLong(0) on error.
  • PyLong(1) on success.

Definition at line 1277 of file sddsdatamodule.c.

1278{
1279 long fileIndex;
1280 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1281 return NULL;
1282 }
1283 return PyLong_FromLong(SDDS_DeleteUnsetColumns(&dataset_f[fileIndex]));
1284}
int32_t SDDS_DeleteUnsetColumns(SDDS_DATASET *SDDS_dataset)
Deletes all columns from an SDDS dataset that are not marked as "of interest".

◆ sddsdata_DeleteUnsetRows()

static PyObject * sddsdata_DeleteUnsetRows ( PyObject * self,
PyObject * args )
static

Deletes all unset rows in the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
PyObject*:
  • PyLong(0) on error.
  • PyLong(1) on success.

Definition at line 1295 of file sddsdatamodule.c.

1296{
1297 long fileIndex;
1298 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1299 return NULL;
1300 }
1301 return PyLong_FromLong(SDDS_DeleteUnsetRows(&dataset_f[fileIndex]));
1302}
int32_t SDDS_DeleteUnsetRows(SDDS_DATASET *SDDS_dataset)
Deletes rows from an SDDS dataset that are not marked as "of interest".

◆ sddsdata_DisableFSync()

static PyObject * sddsdata_DisableFSync ( PyObject * self,
PyObject * args )
static

Disables filesystem synchronization (fsync) for an SDDS dataset.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
Returns
PyObject*
  • Py_None (Python's None).

Definition at line 235 of file sddsdatamodule.c.

236{
237 long fileIndex;
238 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
239 return NULL;
240 }
241 dataset_f[fileIndex].layout.data_mode.fsync_data = 0;
242 return Py_None;
243}

◆ sddsdata_EnableFSync()

static PyObject * sddsdata_EnableFSync ( PyObject * self,
PyObject * args )
static

Enables filesystem synchronization (fsync) for an SDDS dataset.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
Returns
PyObject*
  • Py_None (Python's None).

Definition at line 215 of file sddsdatamodule.c.

216{
217 long fileIndex;
218 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
219 return NULL;
220 }
221 dataset_f[fileIndex].layout.data_mode.fsync_data = 1;
222 return Py_None;
223}

◆ sddsdata_EraseData()

static PyObject * sddsdata_EraseData ( PyObject * self,
PyObject * args )
static

Erases data from an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 616 of file sddsdatamodule.c.

617{
618 long fileIndex;
619 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
620 return NULL;
621 }
622 return PyLong_FromLong(SDDS_EraseData(&dataset_f[fileIndex]));
623}
int32_t SDDS_EraseData(SDDS_DATASET *SDDS_dataset)
Erases all data entries in the SDDS dataset.

◆ sddsdata_GetArray()

static PyObject * sddsdata_GetArray ( PyObject * self,
PyObject * args )
static

Retrieves an array's data from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • indexOrName: Index or name of the array to retrieve.
Returns
PyObject*:
  • NULL on error.
  • List of values from the array on success.

Definition at line 3242 of file sddsdatamodule.c.

3243{
3244 long fileIndex;
3245 PyObject *indexOrName;
3246 long originalType, i, elements;
3247 SDDS_ARRAY *arrayValue=NULL;
3248 char *name;
3249 char **data;
3250 int32_t number;
3251 char buffer[40];
3252 long index;
3253 PyObject *v;
3254 if (!PyArg_ParseTuple(args, "lO", &fileIndex, &indexOrName)) {
3255 return NULL;
3256 }
3257 if (PyString_Check(indexOrName)) {
3258 index = SDDS_GetArrayIndex(&dataset_f[fileIndex], PyString_AsString(indexOrName));
3259 } else if (PyNumber_Check(indexOrName)) {
3260 if (PyInt_Check(indexOrName))
3261 index = PyInt_AsLong(indexOrName);
3262 else if (PyLong_Check(indexOrName))
3263 index = PyLong_AsLong(indexOrName);
3264 else
3265 return NULL;
3266 } else
3267 return NULL;
3268
3269 data = SDDS_GetArrayNames(&dataset_f[fileIndex], &number);
3270 if (!(data))
3271 return NULL;
3272 if ((index >= 0) && (index < number)) {
3273 name = data[index];
3274 } else {
3275 return NULL;
3276 }
3277
3278 arrayValue = SDDS_GetArray(&(dataset_f[fileIndex]), name, NULL);
3279
3280 for (i=0;i<number;i++)
3281 free(data[i]);
3282 free(data);
3283
3284 originalType = arrayValue->definition->type;
3285
3286 if (!(arrayValue))
3287 return NULL;
3288
3289 elements = arrayValue->elements;
3290
3291 /*
3292 if (!(v = PyList_New(arrayValue->definition->dimensions)))
3293 return NULL;
3294 for (i=0;i<arrayValue>dimensions;i++) {
3295 if (!(v[i] = PyList_New(arrayValue->dimension[i])))
3296 return NULL;
3297 }
3298 */
3299 if (!(v = PyList_New(arrayValue->elements)))
3300 return NULL;
3301
3302 switch (originalType) {
3303 case SDDS_SHORT:
3304 for (i=0;i < elements;i++) {
3305 PyList_SetItem(v, i, PyLong_FromLong((long)(((short*)arrayValue->data)[i])));
3306 }
3307 break;
3308 case SDDS_USHORT:
3309 for (i=0;i < elements;i++) {
3310 PyList_SetItem(v, i, PyLong_FromLong((long)(((unsigned short*)arrayValue->data)[i])));
3311 }
3312 break;
3313 case SDDS_LONG:
3314 for (i=0;i < elements;i++) {
3315 PyList_SetItem(v, i, PyLong_FromLong((long)(((int32_t*)arrayValue->data)[i])));
3316 }
3317 break;
3318 case SDDS_ULONG:
3319 for (i=0;i < elements;i++) {
3320 PyList_SetItem(v, i, PyLong_FromUnsignedLong((unsigned long)(((uint32_t*)arrayValue->data)[i])));
3321 }
3322 break;
3323 case SDDS_LONG64:
3324 for (i=0;i < elements;i++) {
3325 PyList_SetItem(v, i, PyLong_FromLongLong((long long)(((int64_t*)arrayValue->data)[i])));
3326 }
3327 break;
3328 case SDDS_ULONG64:
3329 for (i=0;i < elements;i++) {
3330 PyList_SetItem(v, i, PyLong_FromUnsignedLongLong((unsigned long long)(((uint64_t*)arrayValue->data)[i])));
3331 }
3332 break;
3333 case SDDS_FLOAT:
3334 for (i=0;i < elements;i++) {
3335 sprintf(buffer, "%.6E", ((float*)arrayValue->data)[i]);
3336 PyList_SetItem(v, i, PyFloat_FromDouble(atof(buffer)));
3337 }
3338 break;
3339 case SDDS_DOUBLE:
3340 for (i=0;i < elements;i++) {
3341 PyList_SetItem(v, i, PyFloat_FromDouble(((double*)arrayValue->data)[i]));
3342 }
3343 break;
3344 case SDDS_CHARACTER:
3345 for (i=0;i < elements;i++) {
3346 sprintf(buffer, "%c", ((char*)arrayValue->data)[i]);
3347 PyList_SetItem(v, i, PyString_FromString(buffer));
3348 }
3349 break;
3350 case SDDS_STRING:
3351 for (i=0;i < elements;i++) {
3352 PyList_SetItem(v, i, PyString_FromString(((char**)arrayValue->data)[i]));
3353 }
3354 break;
3355 default:
3356 return NULL;
3357 }
3358 SDDS_FreeArray(arrayValue);
3359 return v;
3360}
SDDS_ARRAY * SDDS_GetArray(SDDS_DATASET *SDDS_dataset, char *array_name, SDDS_ARRAY *memory)
Retrieves an array from the current data table of an SDDS dataset.
void SDDS_FreeArray(SDDS_ARRAY *array)
Frees memory allocated for an SDDS array structure.
int32_t SDDS_GetArrayIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named array in the SDDS dataset.
char ** SDDS_GetArrayNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all arrays in the SDDS dataset.
#define SDDS_ULONG
Identifier for the unsigned 32-bit integer data type.
Definition SDDStypes.h:67
#define SDDS_FLOAT
Identifier for the float data type.
Definition SDDStypes.h:43
#define SDDS_STRING
Identifier for the string data type.
Definition SDDStypes.h:85
#define SDDS_ULONG64
Identifier for the unsigned 64-bit integer data type.
Definition SDDStypes.h:55
#define SDDS_SHORT
Identifier for the signed short integer data type.
Definition SDDStypes.h:73
#define SDDS_CHARACTER
Identifier for the character data type.
Definition SDDStypes.h:91
#define SDDS_USHORT
Identifier for the unsigned short integer data type.
Definition SDDStypes.h:79
#define SDDS_LONG64
Identifier for the signed 64-bit integer data type.
Definition SDDStypes.h:49

◆ sddsdata_GetArrayDefinition()

static PyObject * sddsdata_GetArrayDefinition ( PyObject * self,
PyObject * args )
static

Retrieves the definition of an array in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the array.
Returns
Python list containing array attributes on success, NULL on error.

Definition at line 1926 of file sddsdatamodule.c.

1927{
1928 long fileIndex;
1929 char *name;
1930 ARRAY_DEFINITION *pardef;
1931 PyObject *v;
1932 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
1933 return NULL;
1934 }
1935 if ((pardef = SDDS_GetArrayDefinition(&dataset_f[fileIndex], name)) == NULL)
1936 return NULL;
1937 if (!(v = PyList_New(8)))
1938 return NULL;
1939
1940 if (pardef->symbol)
1941 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
1942 else
1943 PyList_SetItem(v, 0, PyString_FromString(""));
1944 if (pardef->units)
1945 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
1946 else
1947 PyList_SetItem(v, 1, PyString_FromString(""));
1948 if (pardef->description)
1949 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
1950 else
1951 PyList_SetItem(v, 2, PyString_FromString(""));
1952 if (pardef->format_string)
1953 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
1954 else
1955 PyList_SetItem(v, 3, PyString_FromString(""));
1956 if (pardef->group_name)
1957 PyList_SetItem(v, 4, PyString_FromString(pardef->group_name));
1958 else
1959 PyList_SetItem(v, 4, PyString_FromString(""));
1960 PyList_SetItem(v, 5, PyLong_FromLong(pardef->type));
1961 PyList_SetItem(v, 6, PyLong_FromLong(pardef->field_length));
1962 PyList_SetItem(v, 7, PyLong_FromLong(pardef->dimensions));
1963
1965
1966 return v;
1967}
ARRAY_DEFINITION * SDDS_GetArrayDefinition(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the definition of a specified array from the SDDS dataset.
int32_t SDDS_FreeArrayDefinition(ARRAY_DEFINITION *source)
Frees memory allocated for an array definition.

◆ sddsdata_GetArrayDimensions()

static PyObject * sddsdata_GetArrayDimensions ( PyObject * self,
PyObject * args )
static

Retrieves the dimensions of an array in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • indexOrName: Index or name of the array.
Returns
PyObject*:
  • NULL on error.
  • List of dimensions of the array on success.

Definition at line 3374 of file sddsdatamodule.c.

3375{
3376 long fileIndex;
3377 PyObject *indexOrName;
3378 long i;
3379 SDDS_ARRAY *arrayValue=NULL;
3380 char *name;
3381 char **data;
3382 int32_t number;
3383 long index;
3384 PyObject *v;
3385 if (!PyArg_ParseTuple(args, "lO", &fileIndex, &indexOrName)) {
3386 return NULL;
3387 }
3388 if (PyString_Check(indexOrName)) {
3389 index = SDDS_GetArrayIndex(&dataset_f[fileIndex], PyString_AsString(indexOrName));
3390 } else if (PyNumber_Check(indexOrName)) {
3391 if (PyInt_Check(indexOrName))
3392 index = PyInt_AsLong(indexOrName);
3393 else if (PyLong_Check(indexOrName))
3394 index = PyLong_AsLong(indexOrName);
3395 else
3396 return NULL;
3397 } else
3398 return NULL;
3399
3400 data = SDDS_GetArrayNames(&dataset_f[fileIndex], &number);
3401 if (!(data))
3402 return NULL;
3403 if ((index >= 0) && (index < number)) {
3404 name = data[index];
3405 } else {
3406 return NULL;
3407 }
3408
3409 arrayValue = SDDS_GetArray(&(dataset_f[fileIndex]), name, NULL);
3410
3411 for (i=0;i<number;i++)
3412 free(data[i]);
3413 free(data);
3414
3415 if (!(arrayValue))
3416 return NULL;
3417
3418 if (!(v = PyList_New(arrayValue->definition->dimensions)))
3419 return NULL;
3420 for (i=0;i<arrayValue->definition->dimensions;i++) {
3421 PyList_SetItem(v, i, PyLong_FromLong(arrayValue->dimension[i]));
3422 }
3423 SDDS_FreeArray(arrayValue);
3424 return v;
3425}

◆ sddsdata_GetArrayIndex()

static PyObject * sddsdata_GetArrayIndex ( PyObject * self,
PyObject * args )
static

Retrieves the index of an array in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the array.
Returns
Python integer (index on success, -1 on error).

Definition at line 1765 of file sddsdatamodule.c.

1766{
1767 long fileIndex;
1768 char *name;
1769 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
1770 return NULL;
1771 }
1772 return PyLong_FromLong(SDDS_GetArrayIndex(&dataset_f[fileIndex], name));
1773}

◆ sddsdata_GetArrayNameFromIndex()

static PyObject * sddsdata_GetArrayNameFromIndex ( PyObject * self,
PyObject * args )
static

Retrieves an array name by its index from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • index: Index of the array.
Returns
PyObject*:
  • NULL on error.
  • Array name string on success.

Definition at line 2428 of file sddsdatamodule.c.

2429{
2430 long fileIndex;
2431 long index;
2432 char **data;
2433 int32_t number;
2434 PyObject *v;
2435 long i;
2436 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &index)) {
2437 return NULL;
2438 }
2439 data = SDDS_GetArrayNames(&dataset_f[fileIndex], &number);
2440 if (!(data))
2441 return NULL;
2442 if ((index >= 0) && (index < number)) {
2443 v = PyString_FromString(data[index]);
2444 for (i=0;i<number;i++)
2445 free(data[i]);
2446 free(data);
2447 return v;
2448 }
2449 for (i=0;i<number;i++)
2450 free(data[i]);
2451 free(data);
2452 return NULL;
2453}

◆ sddsdata_GetArrayNames()

static PyObject * sddsdata_GetArrayNames ( PyObject * self,
PyObject * args )
static

Retrieves all array names from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
Returns
PyObject*:
  • NULL on error.
  • List of array names on success.

Definition at line 2466 of file sddsdatamodule.c.

2467{
2468 long fileIndex;
2469 long index;
2470 char **data;
2471 int32_t number;
2472 PyObject *v;
2473 long i;
2474 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
2475 return NULL;
2476 }
2477 data = SDDS_GetArrayNames(&dataset_f[fileIndex], &number);
2478 if (!(data))
2479 return NULL;
2480 if (!(v = PyList_New(number)))
2481 return NULL;
2482 for (index = 0; index < number; index++)
2483 PyList_SetItem(v, index, PyString_FromString(data[index]));
2484 for (i=0;i<number;i++)
2485 free(data[i]);
2486 free(data);
2487 return v;
2488}

◆ sddsdata_GetArrayType()

static PyObject * sddsdata_GetArrayType ( PyObject * self,
PyObject * args )
static

Retrieves the type of an array in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • index (long): Array index.
Returns
Python integer (type on success, 0 on error).

Definition at line 1822 of file sddsdatamodule.c.

1823{
1824 long fileIndex;
1825 long index;
1826 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &index)) {
1827 return NULL;
1828 }
1829 return PyLong_FromLong(SDDS_GetArrayType(&dataset_f[fileIndex], index));
1830}
int32_t SDDS_GetArrayType(SDDS_DATASET *SDDS_dataset, int32_t index)
Retrieves the data type of an array in the SDDS dataset by its index.

◆ sddsdata_GetColumn()

static PyObject * sddsdata_GetColumn ( PyObject * self,
PyObject * args )
static

Retrieves a column's data from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • indexOrName: Index or name of the column to retrieve.
Returns
PyObject*:
  • NULL on error.
  • List of values from the column on success.

Definition at line 3102 of file sddsdatamodule.c.

3103{
3104 long fileIndex;
3105 PyObject *indexOrName;
3106 long originalType;
3107 int64_t rows, i;
3108 void *columnValue;
3109 char *name;
3110 char **data;
3111 int32_t number;
3112 char buffer[40];
3113 long index;
3114 PyObject *v;
3115 if (!PyArg_ParseTuple(args, "lO", &fileIndex, &indexOrName)) {
3116 return NULL;
3117 }
3118 if (PyString_Check(indexOrName)) {
3119 index = SDDS_GetColumnIndex(&dataset_f[fileIndex], PyString_AsString(indexOrName));
3120 } else if (PyNumber_Check(indexOrName)) {
3121 if (PyInt_Check(indexOrName))
3122 index = PyInt_AsLong(indexOrName);
3123 else if (PyLong_Check(indexOrName))
3124 index = PyLong_AsLong(indexOrName);
3125 else
3126 return NULL;
3127 } else
3128 return NULL;
3129
3130 data = SDDS_GetColumnNames(&dataset_f[fileIndex], &number);
3131 if (!(data))
3132 return NULL;
3133 if ((index >= 0) && (index < number)) {
3134 name = data[index];
3135 } else {
3136 return NULL;
3137 }
3138
3139 rows = SDDS_RowCount(&(dataset_f[fileIndex]));
3140 if (rows < 0) {
3141 Py_INCREF(Py_None);
3142 return Py_None;
3143 }
3144
3145 originalType = SDDS_GetColumnType(&(dataset_f[fileIndex]), index);
3146
3147 columnValue = SDDS_GetColumn(&(dataset_f[fileIndex]), name);
3148
3149 for (i=0;i<number;i++)
3150 free(data[i]);
3151 free(data);
3152
3153 if (!(columnValue))
3154 return NULL;
3155
3156 if (!(v = PyList_New(rows)))
3157 return NULL;
3158
3159 switch (originalType) {
3160 case SDDS_SHORT:
3161 for (i=0;i < rows;i++) {
3162 PyList_SetItem(v, i, PyLong_FromLong((long)(((short*)columnValue)[i])));
3163 }
3164 free((short*)columnValue);
3165 break;
3166 case SDDS_USHORT:
3167 for (i=0;i < rows;i++) {
3168 PyList_SetItem(v, i, PyLong_FromLong((long)(((unsigned short*)columnValue)[i])));
3169 }
3170 free((unsigned short*)columnValue);
3171 break;
3172 case SDDS_LONG:
3173 for (i=0;i < rows;i++) {
3174 PyList_SetItem(v, i, PyLong_FromLong((long)(((int32_t*)columnValue)[i])));
3175 }
3176 free((int32_t*)columnValue);
3177 break;
3178 case SDDS_ULONG:
3179 for (i=0;i < rows;i++) {
3180 PyList_SetItem(v, i, PyLong_FromUnsignedLong((unsigned long)(((uint32_t*)columnValue)[i])));
3181 }
3182 free((uint32_t*)columnValue);
3183 break;
3184 case SDDS_LONG64:
3185 for (i=0;i < rows;i++) {
3186 PyList_SetItem(v, i, PyLong_FromLongLong((long long)(((int64_t*)columnValue)[i])));
3187 }
3188 free((int64_t*)columnValue);
3189 break;
3190 case SDDS_ULONG64:
3191 for (i=0;i < rows;i++) {
3192 PyList_SetItem(v, i, PyLong_FromUnsignedLongLong((unsigned long long)(((uint64_t*)columnValue)[i])));
3193 }
3194 free((uint64_t*)columnValue);
3195 break;
3196 case SDDS_FLOAT:
3197 for (i=0;i < rows;i++) {
3198 sprintf(buffer, "%.6E", ((float*)columnValue)[i]);
3199 PyList_SetItem(v, i, PyFloat_FromDouble(atof(buffer)));
3200 }
3201 free((float*)columnValue);
3202 break;
3203 case SDDS_DOUBLE:
3204 for (i=0;i < rows;i++) {
3205 PyList_SetItem(v, i, PyFloat_FromDouble(((double*)columnValue)[i]));
3206 }
3207 free((double*)columnValue);
3208 break;
3209 case SDDS_CHARACTER:
3210 for (i=0;i < rows;i++) {
3211 sprintf(buffer, "%c", ((char*)columnValue)[i]);
3212 PyList_SetItem(v, i, PyString_FromString(buffer));
3213 }
3214 free((char*)columnValue);
3215 break;
3216 case SDDS_STRING:
3217 for (i=0;i < rows;i++) {
3218 PyList_SetItem(v, i, PyString_FromString(((char**)columnValue)[i]));
3219 }
3220 for (i=0;i < rows;i++)
3221 free(((char**)columnValue)[i]);
3222 free((char**)columnValue);
3223 break;
3224 default:
3225 return NULL;
3226 }
3227 return v;
3228}
void * SDDS_GetColumn(SDDS_DATASET *SDDS_dataset, char *column_name)
Retrieves a copy of the data for a specified column, including only rows marked as "of interest".
int32_t SDDS_GetColumnIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named column in the SDDS dataset.
char ** SDDS_GetColumnNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all columns in the SDDS dataset.
int32_t SDDS_GetColumnType(SDDS_DATASET *SDDS_dataset, int32_t index)
Retrieves the data type of a column in the SDDS dataset by its index.

◆ sddsdata_GetColumnDefinition()

static PyObject * sddsdata_GetColumnDefinition ( PyObject * self,
PyObject * args )
static

Retrieves the definition of a column in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the column.
Returns
Python list containing column attributes on success, NULL on error.

Definition at line 1879 of file sddsdatamodule.c.

1880{
1881 long fileIndex;
1882 char *name;
1883 COLUMN_DEFINITION *pardef;
1884 PyObject *v;
1885 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
1886 return NULL;
1887 }
1888 if ((pardef = SDDS_GetColumnDefinition(&dataset_f[fileIndex], name)) == NULL)
1889 return NULL;
1890 if (!(v = PyList_New(6)))
1891 return NULL;
1892
1893 if (pardef->symbol)
1894 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
1895 else
1896 PyList_SetItem(v, 0, PyString_FromString(""));
1897 if (pardef->units)
1898 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
1899 else
1900 PyList_SetItem(v, 1, PyString_FromString(""));
1901 if (pardef->description)
1902 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
1903 else
1904 PyList_SetItem(v, 2, PyString_FromString(""));
1905 if (pardef->format_string)
1906 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
1907 else
1908 PyList_SetItem(v, 3, PyString_FromString(""));
1909 PyList_SetItem(v, 4, PyLong_FromLong(pardef->type));
1910 PyList_SetItem(v, 5, PyLong_FromLong(pardef->field_length));
1911
1913
1914 return v;
1915}
int32_t SDDS_FreeColumnDefinition(COLUMN_DEFINITION *source)
Frees memory allocated for a column definition.
COLUMN_DEFINITION * SDDS_GetColumnDefinition(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the definition of a specified column from the SDDS dataset.
Definition SDDS_utils.c:978

◆ sddsdata_GetColumnIndex()

static PyObject * sddsdata_GetColumnIndex ( PyObject * self,
PyObject * args )
static

Retrieves the index of a column in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the column.
Returns
Python integer (index on success, -1 on error).

Definition at line 1746 of file sddsdatamodule.c.

1747{
1748 long fileIndex;
1749 char *name;
1750 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
1751 return NULL;
1752 }
1753 return PyLong_FromLong(SDDS_GetColumnIndex(&dataset_f[fileIndex], name));
1754}

◆ sddsdata_GetColumnNameFromIndex()

static PyObject * sddsdata_GetColumnNameFromIndex ( PyObject * self,
PyObject * args )
static

Retrieves a column name by its index from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • index: Index of the column.
Returns
PyObject*:
  • NULL on error.
  • Column name string on success.

Definition at line 2354 of file sddsdatamodule.c.

2355{
2356 long fileIndex;
2357 long index;
2358 char **data;
2359 int32_t number;
2360 PyObject *v;
2361 long i;
2362 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &index)) {
2363 return NULL;
2364 }
2365 data = SDDS_GetColumnNames(&dataset_f[fileIndex], &number);
2366 if (!(data))
2367 return NULL;
2368 if ((index >= 0) && (index < number)) {
2369 v = PyString_FromString(data[index]);
2370 for (i=0;i<number;i++)
2371 free(data[i]);
2372 free(data);
2373 return v;
2374 }
2375 for (i=0;i<number;i++)
2376 free(data[i]);
2377 free(data);
2378 return NULL;
2379}

◆ sddsdata_GetColumnNames()

static PyObject * sddsdata_GetColumnNames ( PyObject * self,
PyObject * args )
static

Retrieves all column names from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
Returns
PyObject*:
  • NULL on error.
  • List of column names on success.

Definition at line 2392 of file sddsdatamodule.c.

2393{
2394 long fileIndex;
2395 long index;
2396 char **data;
2397 int32_t number;
2398 PyObject *v;
2399 long i;
2400 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
2401 return NULL;
2402 }
2403 data = SDDS_GetColumnNames(&dataset_f[fileIndex], &number);
2404 if (!(data))
2405 return NULL;
2406 if (!(v = PyList_New(number)))
2407 return NULL;
2408 for (index = 0; index < number; index++)
2409 PyList_SetItem(v, index, PyString_FromString(data[index]));
2410 for (i=0;i<number;i++)
2411 free(data[i]);
2412 free(data);
2413 return v;
2414}

◆ sddsdata_GetColumnType()

static PyObject * sddsdata_GetColumnType ( PyObject * self,
PyObject * args )
static

Retrieves the type of a column in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • index (long): Column index.
Returns
Python integer (type on success, 0 on error).

Definition at line 1803 of file sddsdatamodule.c.

1804{
1805 long fileIndex;
1806 long index;
1807 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &index)) {
1808 return NULL;
1809 }
1810 return PyLong_FromLong(SDDS_GetColumnType(&dataset_f[fileIndex], index));
1811}

◆ sddsdata_GetDescription()

static PyObject * sddsdata_GetDescription ( PyObject * self,
PyObject * args )
static

Gets the description (text and contents) of the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
PyObject*:
  • PyList of [text, contents] on success.
  • NULL on error.

Definition at line 1361 of file sddsdatamodule.c.

1362{
1363 long fileIndex;
1364 char *text;
1365 char *contents;
1366 PyObject *v;
1367 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1368 return NULL;
1369 }
1370 if (SDDS_GetDescription(&dataset_f[fileIndex], &text, &contents) == 0) {
1371 return NULL;
1372 }
1373 if (!(v = PyList_New(2)))
1374 return NULL;
1375 if (text) {
1376 PyList_SetItem(v, 0, PyString_FromString(text));
1377 free(text);
1378 } else {
1379 PyList_SetItem(v, 0, PyString_FromString(""));
1380 }
1381 if (contents) {
1382 PyList_SetItem(v, 1, PyString_FromString(contents));
1383 free(contents);
1384 } else {
1385 PyList_SetItem(v, 1, PyString_FromString(""));
1386 }
1387 return v;
1388}
int32_t SDDS_GetDescription(SDDS_DATASET *SDDS_dataset, char **text, char **contents)
Retrieves the text and contents descriptions from an SDDS dataset.

◆ sddsdata_GetDescriptionContents()

static PyObject * sddsdata_GetDescriptionContents ( PyObject * self,
PyObject * args )
static

Retrieves the description contents for a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
Python string containing the description contents, or NULL on error.

Definition at line 1422 of file sddsdatamodule.c.

1423{
1424 long fileIndex;
1425 char *text;
1426 char *contents;
1427 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1428 return NULL;
1429 }
1430 if (SDDS_GetDescription(&dataset_f[fileIndex], &text, &contents) == 0) {
1431 return NULL;
1432 }
1433 if (contents)
1434 return PyString_FromString(contents);
1435 return PyString_FromString("");
1436}

◆ sddsdata_GetDescriptionText()

static PyObject * sddsdata_GetDescriptionText ( PyObject * self,
PyObject * args )
static

Retrieves the description text for a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
Python string containing the description text, or NULL on error.

Definition at line 1398 of file sddsdatamodule.c.

1399{
1400 long fileIndex;
1401 char *text;
1402 char *contents;
1403 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1404 return NULL;
1405 }
1406 if (SDDS_GetDescription(&dataset_f[fileIndex], &text, &contents) == 0) {
1407 return NULL;
1408 }
1409 if (text)
1410 return PyString_FromString(text);
1411 return PyString_FromString("");
1412}

◆ sddsdata_GetMode()

static PyObject * sddsdata_GetMode ( PyObject * self,
PyObject * args )
static

Retrieves the data mode of a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
Returns
PyObject*:
  • Data mode of the dataset.

Definition at line 3548 of file sddsdatamodule.c.

3549{
3550 long fileIndex;
3551 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
3552 return NULL;
3553 }
3554 return PyLong_FromLong(dataset_f[fileIndex].layout.data_mode.mode);
3555}

◆ sddsdata_GetNamedArrayType()

static PyObject * sddsdata_GetNamedArrayType ( PyObject * self,
PyObject * args )
static

Retrieves the type of an array by name in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the array.
Returns
Python integer (type on success, 0 on error).

Definition at line 1860 of file sddsdatamodule.c.

1861{
1862 long fileIndex;
1863 char *name;
1864 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
1865 return NULL;
1866 }
1867 return PyLong_FromLong(SDDS_GetNamedArrayType(&dataset_f[fileIndex], name));
1868}
int32_t SDDS_GetNamedArrayType(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the data type of an array in the SDDS dataset by its name.

◆ sddsdata_GetNamedColumnType()

static PyObject * sddsdata_GetNamedColumnType ( PyObject * self,
PyObject * args )
static

Retrieves the type of a column by name in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the column.
Returns
Python integer (type on success, 0 on error).

Definition at line 1841 of file sddsdatamodule.c.

1842{
1843 long fileIndex;
1844 char *name;
1845 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
1846 return NULL;
1847 }
1848 return PyLong_FromLong(SDDS_GetNamedColumnType(&dataset_f[fileIndex], name));
1849}
int32_t SDDS_GetNamedColumnType(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the data type of a column in the SDDS dataset by its name.

◆ sddsdata_GetNamedParameterType()

static PyObject * sddsdata_GetNamedParameterType ( PyObject * self,
PyObject * args )
static

Retrieves the type of a parameter by name in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the parameter.
Returns
Python integer (type on success, 0 on error).

Definition at line 1997 of file sddsdatamodule.c.

1998{
1999 long fileIndex;
2000 char *name;
2001 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
2002 return NULL;
2003 }
2004 return PyLong_FromLong(SDDS_GetNamedParameterType(&dataset_f[fileIndex], name));
2005}
int32_t SDDS_GetNamedParameterType(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the data type of a parameter in the SDDS dataset by its name.

◆ sddsdata_GetParameter()

static PyObject * sddsdata_GetParameter ( PyObject * self,
PyObject * args )
static

Retrieves the value of a parameter from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • indexOrName: Index or name of the parameter.
Returns
PyObject*:
  • NULL on error.
  • Parameter value on success.

Definition at line 3439 of file sddsdatamodule.c.

3440{
3441 long fileIndex;
3442 PyObject *indexOrName;
3443 long originalType;
3444 void *parameterValue;
3445 char *name;
3446 char **data;
3447 int32_t number;
3448 char buffer[40];
3449 long index;
3450 long i;
3451 PyObject *v=NULL;
3452 if (!PyArg_ParseTuple(args, "lO", &fileIndex, &indexOrName)) {
3453 return NULL;
3454 }
3455 if (PyString_Check(indexOrName)) {
3456 index = SDDS_GetParameterIndex(&dataset_f[fileIndex], PyString_AsString(indexOrName));
3457 } else if (PyNumber_Check(indexOrName)) {
3458 if (PyInt_Check(indexOrName))
3459 index = PyInt_AsLong(indexOrName);
3460 else if (PyLong_Check(indexOrName))
3461 index = PyLong_AsLong(indexOrName);
3462 else
3463 return NULL;
3464 } else
3465 return NULL;
3466
3467 data = SDDS_GetParameterNames(&dataset_f[fileIndex], &number);
3468 if (!(data))
3469 return NULL;
3470 if ((index >= 0) && (index < number)) {
3471 name = data[index];
3472 } else {
3473 return NULL;
3474 }
3475 if (!name) {
3476 return NULL;
3477 }
3478
3479 parameterValue = SDDS_GetParameter(&(dataset_f[fileIndex]), name, NULL);
3480
3481 for (i=0;i<number;i++)
3482 free(data[i]);
3483 free(data);
3484
3485 if (!(parameterValue)) {
3486 return NULL;
3487 }
3488 originalType = SDDS_GetParameterType(&dataset_f[fileIndex], index);
3489
3490 switch (originalType) {
3491 case SDDS_SHORT:
3492 v = PyLong_FromLong((long)(((short*)parameterValue)[0]));
3493 free((short*)parameterValue);
3494 break;
3495 case SDDS_USHORT:
3496 v = PyLong_FromLong((long)(((unsigned short*)parameterValue)[0]));
3497 free((unsigned short*)parameterValue);
3498 break;
3499 case SDDS_LONG:
3500 v = PyLong_FromLong((long)(((int32_t*)parameterValue)[0]));
3501 free((int32_t*)parameterValue);
3502 break;
3503 case SDDS_ULONG:
3504 v = PyLong_FromUnsignedLong((unsigned long)(((uint32_t*)parameterValue)[0]));
3505 free((uint32_t*)parameterValue);
3506 break;
3507 case SDDS_LONG64:
3508 v = PyLong_FromLongLong((long long)(((int64_t*)parameterValue)[0]));
3509 free((int64_t*)parameterValue);
3510 break;
3511 case SDDS_ULONG64:
3512 v = PyLong_FromUnsignedLongLong((unsigned long long)(((uint64_t*)parameterValue)[0]));
3513 free((uint64_t*)parameterValue);
3514 break;
3515 case SDDS_FLOAT:
3516 sprintf(buffer, "%.6E", ((float*)parameterValue)[0]);
3517 v = PyFloat_FromDouble(atof(buffer));
3518 free((float*)parameterValue);
3519 break;
3520 case SDDS_DOUBLE:
3521 v = PyFloat_FromDouble(((double*)parameterValue)[0]);
3522 free((double*)parameterValue);
3523 break;
3524 case SDDS_CHARACTER:
3525 sprintf(buffer, "%c", ((char*)parameterValue)[0]);
3526 v = PyString_FromString(buffer);
3527 free((char*)parameterValue);
3528 break;
3529 case SDDS_STRING:
3530 v = PyString_FromString(((char**)parameterValue)[0]);
3531 free(((char**)parameterValue)[0]);
3532 free((char**)parameterValue);
3533 break;
3534 }
3535 return v;
3536}
void * SDDS_GetParameter(SDDS_DATASET *SDDS_dataset, char *parameter_name, void *memory)
Retrieves the value of a specified parameter from the current data table of a data set.
int32_t SDDS_GetParameterType(SDDS_DATASET *SDDS_dataset, int32_t index)
Retrieves the data type of a parameter in the SDDS dataset by its index.
char ** SDDS_GetParameterNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all parameters in the SDDS dataset.
int32_t SDDS_GetParameterIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named parameter in the SDDS dataset.

◆ sddsdata_GetParameterDefinition()

static PyObject * sddsdata_GetParameterDefinition ( PyObject * self,
PyObject * args )
static

Retrieves the definition of a parameter in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the parameter.
Returns
Python list containing parameter attributes on success, NULL on error.

Definition at line 2016 of file sddsdatamodule.c.

2017{
2018 long fileIndex;
2019 char *name;
2020 PARAMETER_DEFINITION *pardef;
2021 PyObject *v;
2022 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
2023 return NULL;
2024 }
2025 if ((pardef = SDDS_GetParameterDefinition(&dataset_f[fileIndex], name)) == NULL)
2026 return NULL;
2027 if (!(v = PyList_New(6)))
2028 return NULL;
2029
2030 if (pardef->symbol)
2031 PyList_SetItem(v, 0, PyString_FromString(pardef->symbol));
2032 else
2033 PyList_SetItem(v, 0, PyString_FromString(""));
2034 if (pardef->units)
2035 PyList_SetItem(v, 1, PyString_FromString(pardef->units));
2036 else
2037 PyList_SetItem(v, 1, PyString_FromString(""));
2038 if (pardef->description)
2039 PyList_SetItem(v, 2, PyString_FromString(pardef->description));
2040 else
2041 PyList_SetItem(v, 2, PyString_FromString(""));
2042 if (pardef->format_string)
2043 PyList_SetItem(v, 3, PyString_FromString(pardef->format_string));
2044 else
2045 PyList_SetItem(v, 3, PyString_FromString(""));
2046 PyList_SetItem(v, 4, PyLong_FromLong(pardef->type));
2047 if (pardef->fixed_value)
2048 PyList_SetItem(v, 5, PyString_FromString(pardef->fixed_value));
2049 else
2050 PyList_SetItem(v, 5, PyString_FromString(""));
2051
2053
2054 return v;
2055}
PARAMETER_DEFINITION * SDDS_GetParameterDefinition(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the definition of a specified parameter from the SDDS dataset.
int32_t SDDS_FreeParameterDefinition(PARAMETER_DEFINITION *source)
Frees memory allocated for a parameter definition.

◆ sddsdata_GetParameterIndex()

static PyObject * sddsdata_GetParameterIndex ( PyObject * self,
PyObject * args )
static

Retrieves the index of a parameter in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • name (char*): Name of the parameter.
Returns
Python integer (index on success, -1 on error).

Definition at line 1784 of file sddsdatamodule.c.

1785{
1786 long fileIndex;
1787 char *name;
1788 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &name)) {
1789 return NULL;
1790 }
1791 return PyLong_FromLong(SDDS_GetParameterIndex(&dataset_f[fileIndex], name));
1792}

◆ sddsdata_GetParameterNameFromIndex()

static PyObject * sddsdata_GetParameterNameFromIndex ( PyObject * self,
PyObject * args )
static

Retrieves a parameter name by its index from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • index: Index of the parameter.
Returns
PyObject*:
  • NULL on error.
  • Parameter name string on success.

Definition at line 2502 of file sddsdatamodule.c.

2503{
2504 long fileIndex;
2505 long index;
2506 char **data;
2507 int32_t number;
2508 PyObject *v;
2509 long i;
2510 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &index)) {
2511 return NULL;
2512 }
2513 data = SDDS_GetParameterNames(&dataset_f[fileIndex], &number);
2514 if (!(data))
2515 return NULL;
2516 if ((index >= 0) && (index < number)) {
2517 v = PyString_FromString(data[index]);
2518 for (i=0;i<number;i++)
2519 free(data[i]);
2520 free(data);
2521 return v;
2522 }
2523 for (i=0;i<number;i++)
2524 free(data[i]);
2525 free(data);
2526 return NULL;
2527}

◆ sddsdata_GetParameterNames()

static PyObject * sddsdata_GetParameterNames ( PyObject * self,
PyObject * args )
static

Retrieves all parameter names from a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
Returns
PyObject*:
  • NULL on error.
  • List of parameter names on success.

Definition at line 2540 of file sddsdatamodule.c.

2541{
2542 long fileIndex;
2543 long index;
2544 char **data;
2545 int32_t number;
2546 PyObject *v;
2547 long i;
2548 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
2549 return NULL;
2550 }
2551 data = SDDS_GetParameterNames(&dataset_f[fileIndex], &number);
2552 if (!(data))
2553 return NULL;
2554 if (!(v = PyList_New(number)))
2555 return NULL;
2556 for (index = 0; index < number; index++)
2557 PyList_SetItem(v, index, PyString_FromString(data[index]));
2558 for (i=0;i<number;i++)
2559 free(data[i]);
2560 free(data);
2561 return v;
2562}

◆ sddsdata_GetParameterType()

static PyObject * sddsdata_GetParameterType ( PyObject * self,
PyObject * args )
static

Retrieves the type of a parameter in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex (long): Dataset index.
  • index (long): Parameter index.
Returns
Python integer (type on success, 0 on error).

Definition at line 1978 of file sddsdatamodule.c.

1979{
1980 long fileIndex;
1981 long index;
1982 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &index)) {
1983 return NULL;
1984 }
1985 return PyLong_FromLong(SDDS_GetParameterType(&dataset_f[fileIndex], index));
1986}

◆ sddsdata_GetRowFlag()

static PyObject * sddsdata_GetRowFlag ( PyObject * self,
PyObject * args )
static

Gets the flag value for a specific row in the dataset.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • row (long): Row number for which the flag is retrieved.
Returns
PyObject*:
  • -1 on error.
  • Row flag on success.

Definition at line 1218 of file sddsdatamodule.c.

1219{
1220 long fileIndex;
1221 long row;
1222 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &row)) {
1223 return NULL;
1224 }
1225 return PyLong_FromLong(SDDS_GetRowFlag(&dataset_f[fileIndex], row));
1226}
int32_t SDDS_GetRowFlag(SDDS_DATASET *SDDS_dataset, int64_t row)
Retrieves the acceptance flag of a specific row in the current data table.

◆ sddsdata_GetTypeName()

static PyObject * sddsdata_GetTypeName ( PyObject * self,
PyObject * args )
static

Retrieves the name of a given SDDS data type.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • type (long): SDDS data type.
Returns
Python string (type name on success, NULL on error).

Definition at line 2082 of file sddsdatamodule.c.

2083{
2084 long type;
2085 char *name;
2086 char msgbuf[256];
2087 if (!PyArg_ParseTuple(args, "l", &type)) {
2088 return NULL;
2089 }
2090 name = SDDS_GetTypeName(type);
2091 if (name)
2092 return PyString_FromString(name);
2093 sprintf(msgbuf, "sdds.GetTypeName: %ld is an invalid SDDS data type", type);
2094 PyErr_SetString(PyExc_StandardError, msgbuf);
2095 return NULL;
2096}
char * SDDS_GetTypeName(int32_t type)
Retrieves the name of a specified SDDS data type as a string.

◆ sddsdata_GetTypeSize()

static PyObject * sddsdata_GetTypeSize ( PyObject * self,
PyObject * args )
static

Retrieves the size of a given SDDS data type.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • type (long): SDDS data type.
Returns
Python integer (size on success, -1 on error).

Definition at line 2065 of file sddsdatamodule.c.

2066{
2067 long type;
2068 if (!PyArg_ParseTuple(args, "l", &type)) {
2069 return NULL;
2070 }
2071 return PyLong_FromLong(SDDS_GetTypeSize(type));
2072}
int32_t SDDS_GetTypeSize(int32_t type)
Retrieves the size in bytes of a specified SDDS data type.

◆ sddsdata_HasWhitespace()

static PyObject * sddsdata_HasWhitespace ( PyObject * self,
PyObject * args )
static

Determines if a string contains whitespace.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • string (char*): String to check.
Returns
Python integer (1 if true, 0 otherwise).

Definition at line 2192 of file sddsdatamodule.c.

2193{
2194 char *string;
2195 if (!PyArg_ParseTuple(args, "s", &string)) {
2196 return NULL;
2197 }
2198 return PyLong_FromLong(SDDS_HasWhitespace(string));
2199}
int32_t SDDS_HasWhitespace(char *string)
Checks if a string contains any whitespace characters.

◆ sddsdata_IdentifyType()

static PyObject * sddsdata_IdentifyType ( PyObject * self,
PyObject * args )
static

Identifies the SDDS data type for a given type name.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • typeName (char*): Name of the data type (e.g., double, float).
Returns
Python integer (type on success, 0 on error).

Definition at line 2106 of file sddsdatamodule.c.

2107{
2108 char *typeName;
2109 if (!PyArg_ParseTuple(args, "s", &typeName)) {
2110 return NULL;
2111 }
2112 return PyLong_FromLong(SDDS_IdentifyType(typeName));
2113}
int32_t SDDS_IdentifyType(char *typeName)
Identifies the SDDS data type based on its string name.

◆ sddsdata_InitHeaderlessInput()

static PyObject * sddsdata_InitHeaderlessInput ( PyObject * self,
PyObject * args )
static

Initializes a headerless input for a dataset file.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • filename (char*): Name of the file to initialize.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 1071 of file sddsdatamodule.c.

1072{
1073 long fileIndex;
1074 char *filename;
1075 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &filename)) {
1076 return NULL;
1077 }
1078 return PyLong_FromLong(SDDS_InitializeHeaderlessInput(&dataset_f[fileIndex], filename));
1079}
int32_t SDDS_InitializeHeaderlessInput(SDDS_DATASET *SDDS_dataset, char *filename)
Initializes the SDDS dataset for headerless input.
Definition SDDS_input.c:175

◆ sddsdata_InitializeAppend()

static PyObject * sddsdata_InitializeAppend ( PyObject * self,
PyObject * args )
static

Initializes an SDDS dataset for appending data to a file.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
  • filename (char*): Name of the file to append to.
Returns
PyObject*
  • 1 on success.
  • 0 on error.

Definition at line 71 of file sddsdatamodule.c.

72{
73 long fileIndex;
74 char *filename;
75 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &filename)) {
76 return NULL;
77 }
78 return PyLong_FromLong(SDDS_InitializeAppend(&dataset_f[fileIndex], filename));
79}
int32_t SDDS_InitializeAppend(SDDS_DATASET *SDDS_dataset, const char *filename)
Initializes the SDDS dataset for appending data by adding a new page to an existing file.

◆ sddsdata_InitializeAppendToPage()

static PyObject * sddsdata_InitializeAppendToPage ( PyObject * self,
PyObject * args )
static

Initializes appending data to an existing SDDS page in a file.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
  • filename (char*): Name of the file to append to.
  • updateInterval (long): Interval at which data should be updated.
Returns
PyObject*
  • Number of rows in the page on success.
  • NULL on error.

Definition at line 94 of file sddsdatamodule.c.

95{
96 long fileIndex;
97 char *filename;
98 long updateInterval, result;
99 int64_t rowsPresent;
100 if (!PyArg_ParseTuple(args, "lsl", &fileIndex, &filename, &updateInterval)) {
101 return NULL;
102 }
103 result = SDDS_InitializeAppendToPage(&dataset_f[fileIndex], filename, updateInterval, &rowsPresent);
104 if (result != 1)
105 return NULL;
106 return PyLong_FromLongLong((long long)rowsPresent);
107}
int32_t SDDS_InitializeAppendToPage(SDDS_DATASET *SDDS_dataset, const char *filename, int64_t updateInterval, int64_t *rowsPresentReturn)
Initializes the SDDS dataset for appending data to the last page of an existing file.

◆ sddsdata_InitializeCopy()

static PyObject * sddsdata_InitializeCopy ( PyObject * self,
PyObject * args )
static

Initializes a copy from one SDDS dataset to another.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndexTarget (long): Index of the target dataset.
  • fileIndexSource (long): Index of the source dataset.
  • filename (char*): Name of the target file (can be NULL).
  • filemode (char*): File mode for the target file ("r", "w", "rb", "wb", "m").
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 702 of file sddsdatamodule.c.

703{
704 long fileIndexTarget;
705 long fileIndexSource;
706 char *filename;
707 char *filemode;
708 if (!PyArg_ParseTuple(args, "llss", &fileIndexTarget, &fileIndexSource, &filename, &filemode)) {
709 return NULL;
710 }
711 if (filename)
712 if (strlen(filename) == 0)
713 filename = NULL;
714 return PyLong_FromLong(SDDS_InitializeCopy(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], filename, filemode));
715}
int32_t SDDS_InitializeCopy(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, char *filename, char *filemode)
Definition SDDS_copy.c:40

◆ sddsdata_InitializeInput()

static PyObject * sddsdata_InitializeInput ( PyObject * self,
PyObject * args )
static

Initializes an SDDS dataset for input from a file.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
  • filename (char*): Name of the input file.
Returns
PyObject*
  • 1 on success.
  • 0 on error.

Definition at line 49 of file sddsdatamodule.c.

50{
51 long fileIndex;
52 char *filename;
53 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &filename)) {
54 return NULL;
55 }
56 return PyLong_FromLong(SDDS_InitializeInput(&dataset_f[fileIndex], filename));
57}
int32_t SDDS_InitializeInput(SDDS_DATASET *SDDS_dataset, char *filename)
Definition SDDS_input.c:49

◆ sddsdata_InitializeOutput()

static PyObject * sddsdata_InitializeOutput ( PyObject * self,
PyObject * args )
static

Initializes an SDDS dataset for output to a file.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
  • data_mode (long): Data mode (e.g., SDDS_BINARY or SDDS_ASCII).
  • lines_per_row (long): Number of lines per row in the output file.
  • description (char*): Description of the dataset.
  • contents (char*): Contents of the dataset.
  • filename (char*): Name of the output file.
Returns
PyObject*
  • 1 on success.
  • 0 on error.

Definition at line 125 of file sddsdatamodule.c.

126{
127 long fileIndex;
128 long data_mode;
129 long lines_per_row;
130 char *description;
131 char *contents;
132 char *filename;
133 if (!PyArg_ParseTuple(args, "lllsss", &fileIndex, &data_mode, &lines_per_row, &description, &contents, &filename)) {
134 return NULL;
135 }
136 if (description)
137 if (strlen(description) == 0)
138 description = NULL;
139 if (contents)
140 if (strlen(contents) == 0)
141 contents = NULL;
142 return PyLong_FromLong(SDDS_InitializeOutput(&dataset_f[fileIndex], data_mode, lines_per_row, description, contents, filename));
143}
int32_t SDDS_InitializeOutput(SDDS_DATASET *SDDS_dataset, int32_t data_mode, int32_t lines_per_row, const char *description, const char *contents, const char *filename)
Initializes the SDDS output dataset.

◆ sddsdata_IsValidName()

static PyObject * sddsdata_IsValidName ( PyObject * self,
PyObject * args )
static

Validates a name for SDDS compatibility.

Parameters
selfUnused.
argsA tuple containing:
  • name (char*): The name to validate.
Returns
PyObject* A Python integer (1 if valid, 0 if invalid).

Definition at line 477 of file sddsdatamodule.c.

478{
479 char *name;
480 if (!PyArg_ParseTuple(args, "s", &name)) {
481 return NULL;
482 }
483 return PyLong_FromLong(SDDS_IsValidName(name, NULL));
484}
int32_t SDDS_IsValidName(const char *name, const char *class)
Checks if a given name is valid for a specified class within the SDDS dataset.

◆ sddsdata_LengthenTable()

static PyObject * sddsdata_LengthenTable ( PyObject * self,
PyObject * args )
static

Lengthens the table by adding additional rows.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • n_additional_rows (long): Number of rows to add.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 1011 of file sddsdatamodule.c.

1012{
1013 long fileIndex;
1014 long n_additional_rows;
1015 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &n_additional_rows)) {
1016 return NULL;
1017 }
1018 return PyLong_FromLong(SDDS_LengthenTable(&dataset_f[fileIndex], n_additional_rows));
1019}
int32_t SDDS_LengthenTable(SDDS_DATASET *SDDS_dataset, int64_t n_additional_rows)

◆ sddsdata_NumberOfErrors()

static PyObject * sddsdata_NumberOfErrors ( PyObject * self,
PyObject * args )
static

Returns the number of errors recorded.

Parameters
selfPython object (unused).
argsPython tuple (unused).
Returns
Python integer representing the number of errors.

Definition at line 1445 of file sddsdatamodule.c.

1446{
1447 return PyLong_FromLong(SDDS_NumberOfErrors());
1448}
int32_t SDDS_NumberOfErrors()
Retrieves the number of errors recorded by SDDS library routines.
Definition SDDS_utils.c:304

◆ sddsdata_ParameterCount()

static PyObject * sddsdata_ParameterCount ( PyObject * self,
PyObject * args )
static

Gets the count of parameters in the dataset.

Parameters
selfPython object (unused).
argsPython arguments tuple containing:
  • fileIndex (long): Index of the dataset file.
Returns
PyObject*: Number of parameters as PyLong.

Definition at line 1343 of file sddsdatamodule.c.

1344{
1345 long fileIndex;
1346 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1347 return NULL;
1348 }
1349 return PyLong_FromLong(SDDS_ParameterCount(&dataset_f[fileIndex]));
1350}
int32_t SDDS_ParameterCount(SDDS_DATASET *page)
Retrieves the number of parameters in the SDDS dataset.

◆ sddsdata_PrintErrors()

static PyObject * sddsdata_PrintErrors ( PyObject * self,
PyObject * args )
static

Prints error messages based on the provided mode.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • mode (long): Error print mode. Valid values: 0, 1, 2, 3.
Returns
Python None, or NULL on error.

Definition at line 1548 of file sddsdatamodule.c.

1549{
1550 long mode;
1551 if (!PyArg_ParseTuple(args, "l", &mode)) {
1552 return NULL;
1553 }
1554 SDDS_PrintErrors(stderr, mode);
1555 Py_INCREF(Py_None);
1556 return Py_None;
1557}
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
Definition SDDS_utils.c:432

◆ sddsdata_ProcessArrayString()

static PyObject * sddsdata_ProcessArrayString ( PyObject * self,
PyObject * args )
static

Processes an array definition string.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • string (char*): Array definition string.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 658 of file sddsdatamodule.c.

659{
660 long fileIndex;
661 char *string;
662 if (!PyArg_ParseTuple(args, "ls", &fileIndex, &string)) {
663 return NULL;
664 }
665 return PyLong_FromLong(SDDS_ProcessArrayString(&dataset_f[fileIndex], string));
666}
int32_t SDDS_ProcessArrayString(SDDS_DATASET *SDDS_dataset, char *string)
Process an array definition string.

◆ sddsdata_ProcessColumnString()

static PyObject * sddsdata_ProcessColumnString ( PyObject * self,
PyObject * args )
static

Processes a column definition string.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • string (char*): Column definition string.
  • mode (long): Mode for processing (0 for SDDS_NORMAL_DEFINITION, 1 for SDDS_WRITEONLY_DEFINITION).
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 637 of file sddsdatamodule.c.

638{
639 long fileIndex;
640 char *string;
641 long mode;
642 if (!PyArg_ParseTuple(args, "lsl", &fileIndex, &string, &mode)) {
643 return NULL;
644 }
645 return PyLong_FromLong(SDDS_ProcessColumnString(&dataset_f[fileIndex], string, mode));
646}
int32_t SDDS_ProcessColumnString(SDDS_DATASET *SDDS_dataset, char *string, int32_t mode)
Process a column definition string.

◆ sddsdata_ProcessParameterString()

static PyObject * sddsdata_ProcessParameterString ( PyObject * self,
PyObject * args )
static

Processes a parameter definition string.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • string (char*): Parameter definition string.
  • mode (long): Mode for processing (0 for SDDS_NORMAL_DEFINITION, 1 for SDDS_WRITEONLY_DEFINITION).
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 679 of file sddsdatamodule.c.

680{
681 long fileIndex;
682 char *string;
683 long mode;
684 if (!PyArg_ParseTuple(args, "lsl", &fileIndex, &string, &mode)) {
685 return NULL;
686 }
687 return PyLong_FromLong(SDDS_ProcessParameterString(&dataset_f[fileIndex], string, mode));
688}
int32_t SDDS_ProcessParameterString(SDDS_DATASET *SDDS_dataset, char *string, int32_t mode)
Process a parameter definition string.

◆ sddsdata_ReadPage()

static PyObject * sddsdata_ReadPage ( PyObject * self,
PyObject * args )
static

Reads the current page from the dataset file.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
Returns
PyObject*:
  • 0 on error.
  • -1 on EOF.
  • Page number on success.

Definition at line 1092 of file sddsdatamodule.c.

1093{
1094 long fileIndex;
1095 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1096 return NULL;
1097 }
1098 return PyLong_FromLong(SDDS_ReadPage(&dataset_f[fileIndex]));
1099}
int32_t SDDS_ReadPage(SDDS_DATASET *SDDS_dataset)

◆ sddsdata_ReadPageLastRows()

static PyObject * sddsdata_ReadPageLastRows ( PyObject * self,
PyObject * args )
static

Reads the last rows of the current page from the dataset file.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • last_rows (long): Number of last rows to read.
Returns
PyObject*:
  • 0 on error.
  • -1 on EOF.
  • Page number on success.

Definition at line 1137 of file sddsdatamodule.c.

1138{
1139 long fileIndex;
1140 long last_rows;
1141 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &last_rows)) {
1142 return NULL;
1143 }
1144 return PyLong_FromLong(SDDS_ReadPageLastRows(&dataset_f[fileIndex], last_rows));
1145}
int32_t SDDS_ReadPageLastRows(SDDS_DATASET *SDDS_dataset, int64_t last_rows)

◆ sddsdata_ReadPageSparse()

static PyObject * sddsdata_ReadPageSparse ( PyObject * self,
PyObject * args )
static

Reads a sparse page from the dataset file.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • sparse_interval (long): Interval for sparse reading.
  • sparse_offset (long): Offset for sparse reading.
Returns
PyObject*:
  • 0 on error.
  • -1 on EOF.
  • Page number on success.

Definition at line 1114 of file sddsdatamodule.c.

1115{
1116 long fileIndex;
1117 long sparse_interval;
1118 long sparse_offset;
1119 if (!PyArg_ParseTuple(args, "lll", &fileIndex, &sparse_interval, &sparse_offset)) {
1120 return NULL;
1121 }
1122 return PyLong_FromLong(SDDS_ReadPageSparse(&dataset_f[fileIndex], 0, sparse_interval, sparse_offset, 0));
1123}
int32_t SDDS_ReadPageSparse(SDDS_DATASET *SDDS_dataset, uint32_t mode, int64_t sparse_interval, int64_t sparse_offset, int32_t sparse_statistics)

◆ sddsdata_RegisterProgramName()

static PyObject * sddsdata_RegisterProgramName ( PyObject * self,
PyObject * args )
static

Registers a program name for use in error messages.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • name (char*): Name of the program.
Returns
Python None, or NULL on error.

Definition at line 1529 of file sddsdatamodule.c.

1530{
1531 char *name;
1532 if (!PyArg_ParseTuple(args, "s", &name)) {
1533 return NULL;
1534 }
1536 Py_INCREF(Py_None);
1537 return Py_None;
1538}
void SDDS_RegisterProgramName(const char *name)
Registers the executable program name for use in error messages.
Definition SDDS_utils.c:288

◆ sddsdata_RestoreLayout()

static PyObject * sddsdata_RestoreLayout ( PyObject * self,
PyObject * args )
static

Restores the layout of an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 953 of file sddsdatamodule.c.

954{
955 long fileIndex;
956 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
957 return NULL;
958 }
959 return PyLong_FromLong(SDDS_RestoreLayout(&dataset_f[fileIndex]));
960}
int32_t SDDS_RestoreLayout(SDDS_DATASET *SDDS_dataset)
Definition SDDS_copy.c:697

◆ sddsdata_RowCount()

static PyObject * sddsdata_RowCount ( PyObject * self,
PyObject * args )
static

Gets the number of rows in the dataset.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
Returns
PyObject*:
  • Number of rows in the dataset.

Definition at line 1156 of file sddsdatamodule.c.

1157{
1158 long fileIndex;
1159 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1160 return NULL;
1161 }
1162 return PyLong_FromLongLong((long long)SDDS_RowCount(&dataset_f[fileIndex]));
1163}

◆ sddsdata_SaveLayout()

static PyObject * sddsdata_SaveLayout ( PyObject * self,
PyObject * args )
static

Saves the layout of an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 935 of file sddsdatamodule.c.

936{
937 long fileIndex;
938 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
939 return NULL;
940 }
941 return PyLong_FromLong(SDDS_SaveLayout(&dataset_f[fileIndex]));
942}
int32_t SDDS_SaveLayout(SDDS_DATASET *SDDS_dataset)
Definition SDDS_copy.c:615

◆ sddsdata_SetArray()

static PyObject * sddsdata_SetArray ( PyObject * self,
PyObject * args )
static

Sets an array value in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • indexOrName: Index or name of the array.
  • v: Array values.
  • dim: Array dimensions.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 2652 of file sddsdatamodule.c.

2653{
2654 long fileIndex;
2655 long elements;
2656 PyObject *indexOrName;
2657 PyObject *v;
2658 PyObject *dim;
2659 long type;
2660 long i;
2661 void *data = NULL;
2662 long index;
2663 long result=0;
2664 PyObject *temp;
2665 ARRAY_DEFINITION *arraydef;
2666 char **names=NULL;
2667 int32_t number;
2668 int32_t dimensions;
2669 int32_t *dimension=NULL;
2670
2671 if (!PyArg_ParseTuple(args, "lOOO", &fileIndex, &indexOrName, &v, &dim)) {
2672 return NULL;
2673 }
2674 if (PyString_Check(indexOrName)) {
2675 index = SDDS_GetArrayIndex(&dataset_f[fileIndex], PyString_AsString(indexOrName));
2676 if ((arraydef = SDDS_GetArrayDefinition(&dataset_f[fileIndex], PyString_AsString(indexOrName))) == NULL)
2677 return NULL;
2678 } else if (PyNumber_Check(indexOrName)) {
2679 if (PyInt_Check(indexOrName))
2680 index = PyInt_AsLong(indexOrName);
2681 else if (PyLong_Check(indexOrName))
2682 index = PyLong_AsLong(indexOrName);
2683 else
2684 return NULL;
2685 names = SDDS_GetArrayNames(&dataset_f[fileIndex], &number);
2686 if (!(names))
2687 return NULL;
2688 if (number <= index)
2689 return NULL;
2690 if ((arraydef = SDDS_GetArrayDefinition(&dataset_f[fileIndex], names[index])) == NULL)
2691 return NULL;
2692 } else
2693 return NULL;
2694 type = arraydef->type;
2695 dimensions = arraydef->dimensions;
2696
2697 if (dimensions != PyList_Size(dim))
2698 return NULL;
2699 dimension = malloc(sizeof(int32_t)*dimensions);
2700
2701 for (i=0;i<dimensions;i++) {
2702 temp = PyList_GetItem(dim, i);
2703 if (PyInt_Check(temp))
2704 dimension[i] = PyInt_AsLong(temp);
2705 else if (PyLong_Check(temp))
2706 dimension[i] = PyLong_AsLong(temp);
2707 else
2708 return NULL;
2709 }
2710
2711 elements = (long)PyList_Size(v);
2712 switch (type) {
2713 case SDDS_SHORT:
2714 data = malloc(sizeof(short)*elements);
2715 for (i=0;i<elements;i++) {
2716 temp = PyList_GetItem(v, i);
2717 if (PyLong_Check(temp))
2718 ((short*)data)[i] = (short)PyLong_AsLong(temp);
2719 else
2720 ((short*)data)[i] = (short)PyInt_AsLong(temp);
2721 }
2722 break;
2723 case SDDS_USHORT:
2724 data = malloc(sizeof(unsigned short)*elements);
2725 for (i=0;i<elements;i++) {
2726 temp = PyList_GetItem(v, i);
2727 if (PyLong_Check(temp))
2728 ((unsigned short*)data)[i] = (unsigned short)PyLong_AsLong(temp);
2729 else
2730 ((unsigned short*)data)[i] = (unsigned short)PyInt_AsLong(temp);
2731 }
2732 break;
2733 case SDDS_LONG:
2734 data = malloc(sizeof(int32_t)*elements);
2735 for (i=0;i<elements;i++) {
2736 temp = PyList_GetItem(v, i);
2737 if (PyLong_Check(temp))
2738 ((int32_t*)data)[i] = (int32_t)PyLong_AsLong(temp);
2739 else
2740 ((int32_t*)data)[i] = (int32_t)PyInt_AsLong(temp);
2741 }
2742 break;
2743 case SDDS_ULONG:
2744 data = malloc(sizeof(uint32_t)*elements);
2745 for (i=0;i<elements;i++) {
2746 temp = PyList_GetItem(v, i);
2747 if (PyLong_Check(temp))
2748 ((uint32_t*)data)[i] = (uint32_t)PyLong_AsUnsignedLong(temp);
2749 else
2750 ((uint32_t*)data)[i] = (uint32_t)PyInt_AsUnsignedLong(temp);
2751 }
2752 break;
2753 case SDDS_LONG64:
2754 data = malloc(sizeof(int64_t)*elements);
2755 for (i=0;i<elements;i++) {
2756 temp = PyList_GetItem(v, i);
2757 if (PyLong_Check(temp))
2758 ((int64_t*)data)[i] = (int64_t)PyLong_AsLongLong(temp);
2759 else
2760 ((int64_t*)data)[i] = (int64_t)PyInt_AsLongLong(temp);
2761 }
2762 break;
2763 case SDDS_ULONG64:
2764 data = malloc(sizeof(uint64_t)*elements);
2765 for (i=0;i<elements;i++) {
2766 temp = PyList_GetItem(v, i);
2767 if (PyLong_Check(temp))
2768 ((uint64_t*)data)[i] = (uint64_t)PyLong_AsUnsignedLongLong(temp);
2769 else
2770 ((uint64_t*)data)[i] = (uint64_t)PyInt_AsUnsignedLongLong(temp);
2771 }
2772 break;
2773 case SDDS_FLOAT:
2774 data = malloc(sizeof(float)*elements);
2775 for (i=0;i<elements;i++)
2776 ((float*)data)[i] = (float)PyFloat_AsDouble(PyList_GetItem(v, i));
2777 break;
2778 case SDDS_DOUBLE:
2779 data = malloc(sizeof(double)*elements);
2780 for (i=0;i<elements;i++)
2781 ((double*)data)[i] = (double)PyFloat_AsDouble(PyList_GetItem(v, i));
2782 break;
2783 case SDDS_CHARACTER:
2784 data = malloc(sizeof(char)*elements);
2785 for (i=0;i<elements;i++)
2786 ((char*)data)[i] = (char)(PyString_AsString(PyList_GetItem(v, i))[0]);
2787 break;
2788 case SDDS_STRING:
2789 data = malloc(sizeof(char*)*elements);
2790 for (i=0;i<elements;i++)
2791 SDDS_CopyString(((char**)data)+i, PyString_AsString(PyList_GetItem(v, i)));
2792 break;
2793 }
2794 if (PyString_Check(indexOrName)) {
2795 result = SDDS_SetArray(&dataset_f[fileIndex],PyString_AsString(indexOrName),SDDS_CONTIGUOUS_DATA,data,dimension);
2796 } else {
2797 result = SDDS_SetArray(&dataset_f[fileIndex],names[index],SDDS_CONTIGUOUS_DATA,data,dimension);
2798 for (i=0;i<number;i++)
2799 free(names[i]);
2800 free(names);
2801 }
2802 switch (type) {
2803 case SDDS_SHORT:
2804 free((short*)data);
2805 break;
2806 case SDDS_USHORT:
2807 free((unsigned short*)data);
2808 break;
2809 case SDDS_LONG:
2810 free((int32_t*)data);
2811 break;
2812 case SDDS_ULONG:
2813 free((uint32_t*)data);
2814 break;
2815 case SDDS_LONG64:
2816 free((int64_t*)data);
2817 break;
2818 case SDDS_ULONG64:
2819 free((uint64_t*)data);
2820 break;
2821 case SDDS_FLOAT:
2822 free((float*)data);
2823 break;
2824 case SDDS_DOUBLE:
2825 free((double*)data);
2826 break;
2827 case SDDS_CHARACTER:
2828 free((char*)data);
2829 break;
2830 case SDDS_STRING:
2831 for (i=0;i<elements;i++)
2832 free(((char**)data)[i]);
2833 free((char**)data);
2834 break;
2835 }
2836 if (dimension) free(dimension);
2837 return PyLong_FromLong(result);
2838}
int32_t SDDS_SetArray(SDDS_DATASET *SDDS_dataset, char *array_name, int32_t mode, void *data_pointer, int32_t *dimension)
Sets the values of an array variable in the SDDS dataset using specified dimensions.
int32_t SDDS_CopyString(char **target, const char *source)
Copies a source string to a target string with memory allocation.
Definition SDDS_utils.c:856

◆ sddsdata_SetAutoCheckMode()

static PyObject * sddsdata_SetAutoCheckMode ( PyObject * self,
PyObject * args )
static

Sets the auto-check mode for datasets.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • newMode: New auto-check mode (0 or 1).
Returns
PyObject*: Previous mode.

Definition at line 2333 of file sddsdatamodule.c.

2334{
2335 long newMode;
2336 if (!PyArg_ParseTuple(args, "l", &newMode)) {
2337 return NULL;
2338 }
2339 return PyLong_FromLong(SDDS_SetAutoCheckMode(newMode));
2340}
uint32_t SDDS_SetAutoCheckMode(uint32_t newMode)
Sets the automatic check mode for SDDS dataset validation.
Definition SDDS_utils.c:533

◆ sddsdata_SetColumn()

static PyObject * sddsdata_SetColumn ( PyObject * self,
PyObject * args )
static

Sets a column value in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • indexOrName: Index or name of the column.
  • v: List of values to set for the column.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 2853 of file sddsdatamodule.c.

2854{
2855 long fileIndex;
2856 long rows;
2857 PyObject *indexOrName;
2858 PyObject *v;
2859 long type;
2860 long i;
2861 void *data = NULL;
2862 long index;
2863 long result=0;
2864 PyObject *temp;
2865 if (!PyArg_ParseTuple(args, "lOO", &fileIndex, &indexOrName, &v)) {
2866 return NULL;
2867 }
2868 if (PyString_Check(indexOrName)) {
2869 index = SDDS_GetColumnIndex(&dataset_f[fileIndex], PyString_AsString(indexOrName));
2870 } else if (PyNumber_Check(indexOrName)) {
2871 if (PyInt_Check(indexOrName))
2872 index = PyInt_AsLong(indexOrName);
2873 else if (PyLong_Check(indexOrName))
2874 index = PyLong_AsLong(indexOrName);
2875 else
2876 return NULL;
2877 } else
2878 return NULL;
2879 if ((type = SDDS_GetColumnType(&dataset_f[fileIndex], index)) == 0)
2880 return NULL;
2881 rows = (long)PyList_Size(v);
2882 switch (type) {
2883 case SDDS_SHORT:
2884 data = malloc(sizeof(short)*rows);
2885 for (i=0;i<rows;i++) {
2886 temp = PyList_GetItem(v, i);
2887 if (PyLong_Check(temp))
2888 ((short*)data)[i] = (short)PyLong_AsLong(temp);
2889 else
2890 ((short*)data)[i] = (short)PyInt_AsLong(temp);
2891 }
2892 break;
2893 case SDDS_USHORT:
2894 data = malloc(sizeof(unsigned short)*rows);
2895 for (i=0;i<rows;i++) {
2896 temp = PyList_GetItem(v, i);
2897 if (PyLong_Check(temp))
2898 ((unsigned short*)data)[i] = (unsigned short)PyLong_AsLong(temp);
2899 else
2900 ((unsigned short*)data)[i] = (unsigned short)PyInt_AsLong(temp);
2901 }
2902 break;
2903 case SDDS_LONG:
2904 data = malloc(sizeof(int32_t)*rows);
2905 for (i=0;i<rows;i++) {
2906 temp = PyList_GetItem(v, i);
2907 if (PyLong_Check(temp))
2908 ((int32_t*)data)[i] = (int32_t)PyLong_AsLong(temp);
2909 else
2910 ((int32_t*)data)[i] = (int32_t)PyInt_AsLong(temp);
2911 }
2912 break;
2913 case SDDS_ULONG:
2914 data = malloc(sizeof(uint32_t)*rows);
2915 for (i=0;i<rows;i++) {
2916 temp = PyList_GetItem(v, i);
2917 if (PyLong_Check(temp))
2918 ((uint32_t*)data)[i] = (uint32_t)PyLong_AsUnsignedLong(temp);
2919 else
2920 ((uint32_t*)data)[i] = (uint32_t)PyInt_AsUnsignedLong(temp);
2921 }
2922 break;
2923 case SDDS_LONG64:
2924 data = malloc(sizeof(int64_t)*rows);
2925 for (i=0;i<rows;i++) {
2926 temp = PyList_GetItem(v, i);
2927 if (PyLong_Check(temp))
2928 ((int64_t*)data)[i] = (int64_t)PyLong_AsLongLong(temp);
2929 else
2930 ((int64_t*)data)[i] = (int64_t)PyInt_AsLongLong(temp);
2931 }
2932 break;
2933 case SDDS_ULONG64:
2934 data = malloc(sizeof(uint64_t)*rows);
2935 for (i=0;i<rows;i++) {
2936 temp = PyList_GetItem(v, i);
2937 if (PyLong_Check(temp))
2938 ((uint64_t*)data)[i] = (uint64_t)PyLong_AsUnsignedLongLong(temp);
2939 else
2940 ((uint64_t*)data)[i] = (uint64_t)PyInt_AsUnsignedLongLong(temp);
2941 }
2942 break;
2943 case SDDS_FLOAT:
2944 data = malloc(sizeof(float)*rows);
2945 for (i=0;i<rows;i++)
2946 ((float*)data)[i] = (float)PyFloat_AsDouble(PyList_GetItem(v, i));
2947 break;
2948 case SDDS_DOUBLE:
2949 data = malloc(sizeof(double)*rows);
2950 for (i=0;i<rows;i++)
2951 ((double*)data)[i] = (double)PyFloat_AsDouble(PyList_GetItem(v, i));
2952 break;
2953 case SDDS_CHARACTER:
2954 data = malloc(sizeof(char)*rows);
2955 for (i=0;i<rows;i++)
2956 ((char*)data)[i] = (char)(PyString_AsString(PyList_GetItem(v, i))[0]);
2957 break;
2958 case SDDS_STRING:
2959 data = malloc(sizeof(char*)*rows);
2960 for (i=0;i<rows;i++)
2961 SDDS_CopyString(((char**)data)+i, PyString_AsString(PyList_GetItem(v, i)));
2962 break;
2963 }
2964 result = SDDS_SetColumn(&dataset_f[fileIndex],SDDS_SET_BY_INDEX,data,rows,index,NULL);
2965 switch (type) {
2966 case SDDS_SHORT:
2967 free((short*)data);
2968 break;
2969 case SDDS_USHORT:
2970 free((unsigned short*)data);
2971 break;
2972 case SDDS_LONG:
2973 free((int32_t*)data);
2974 break;
2975 case SDDS_ULONG:
2976 free((uint32_t*)data);
2977 break;
2978 case SDDS_LONG64:
2979 free((int64_t*)data);
2980 break;
2981 case SDDS_ULONG64:
2982 free((uint64_t*)data);
2983 break;
2984 case SDDS_FLOAT:
2985 free((float*)data);
2986 break;
2987 case SDDS_DOUBLE:
2988 free((double*)data);
2989 break;
2990 case SDDS_CHARACTER:
2991 free((char*)data);
2992 break;
2993 case SDDS_STRING:
2994 for (i=0;i<rows;i++)
2995 free(((char**)data)[i]);
2996 free((char**)data);
2997 break;
2998 }
2999 return PyLong_FromLong(result);
3000}
int32_t SDDS_SetColumn(SDDS_DATASET *SDDS_dataset, int32_t mode, void *data, int64_t rows,...)
Sets the values for one data column in the current data table of an SDDS dataset.

◆ sddsdata_SetColumnFlags()

static PyObject * sddsdata_SetColumnFlags ( PyObject * self,
PyObject * args )
static

Sets the column flags for the dataset.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • column_flag_value (long): Flag value (valid values: 0, 1).
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 1176 of file sddsdatamodule.c.

1177{
1178 long fileIndex;
1179 long column_flag_value;
1180 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &column_flag_value)) {
1181 return NULL;
1182 }
1183 return PyLong_FromLong(SDDS_SetColumnFlags(&dataset_f[fileIndex], column_flag_value));
1184}
int32_t SDDS_SetColumnFlags(SDDS_DATASET *SDDS_dataset, int32_t column_flag_value)
Sets the acceptance flags for all columns in the current data table of a data set.

◆ sddsdata_SetColumnMajorOrder()

static PyObject * sddsdata_SetColumnMajorOrder ( PyObject * self,
PyObject * args )
static

Sets the data order for the SDDS dataset to column-major.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
Returns
PyObject*
  • Py_None (NULL return value in Python).

Definition at line 155 of file sddsdatamodule.c.

156{
157 long fileIndex;
158 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
159 return NULL;
160 }
161 dataset_f[fileIndex].layout.data_mode.column_major = 1;
162 return Py_None;
163}

◆ sddsdata_SetDataMode()

static PyObject * sddsdata_SetDataMode ( PyObject * self,
PyObject * args )
static

Sets the data mode for a given dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • newmode: New data mode to be set.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 2292 of file sddsdatamodule.c.

2293{
2294 long fileIndex;
2295 long newmode;
2296 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &newmode)) {
2297 return NULL;
2298 }
2299 return PyLong_FromLong(SDDS_SetDataMode(&dataset_f[fileIndex], newmode));
2300}
int32_t SDDS_SetDataMode(SDDS_DATASET *SDDS_dataset, int32_t newmode)
Sets the data mode (ASCII or Binary) for the SDDS dataset.

◆ sddsdata_SetError()

static PyObject * sddsdata_SetError ( PyObject * self,
PyObject * args )
static

Sets an error description.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • error_text (char*): Description of the error.
Returns
Python None, or NULL on error.

Definition at line 1472 of file sddsdatamodule.c.

1473{
1474 char *error_text;
1475 if (!PyArg_ParseTuple(args, "s", &error_text)) {
1476 return NULL;
1477 }
1478 SDDS_SetError(error_text);
1479 Py_INCREF(Py_None);
1480 return Py_None;
1481}
void SDDS_SetError(char *error_text)
Records an error message in the SDDS error stack.
Definition SDDS_utils.c:379

◆ sddsdata_SetFixedRowCountMode()

static PyObject * sddsdata_SetFixedRowCountMode ( PyObject * self,
PyObject * args )
static

Sets the row count mode for an SDDS dataset to fixed row count mode.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
Returns
PyObject*
  • Py_None (Python's None).

Definition at line 175 of file sddsdatamodule.c.

176{
177 long fileIndex;
178 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
179 return NULL;
180 }
181 SDDS_SetRowCountMode(&dataset_f[fileIndex], SDDS_FIXEDROWCOUNT);
182 return Py_None;
183}
int32_t SDDS_SetRowCountMode(SDDS_DATASET *SDDS_dataset, uint32_t mode)
Sets the row count mode for the SDDS dataset.

◆ sddsdata_SetNameValidityFlags()

static PyObject * sddsdata_SetNameValidityFlags ( PyObject * self,
PyObject * args )
static

Sets name validity flags to allow any name.

Parameters
selfUnused.
argsUnused.
Returns
PyObject* A Python integer representing the previous value of nameValidityFlags.

Definition at line 494 of file sddsdatamodule.c.

495{
496 return PyLong_FromLong(SDDS_SetNameValidityFlags(SDDS_ALLOW_ANY_NAME));
497}
int32_t SDDS_SetNameValidityFlags(uint32_t flags)
Sets the validity flags for parameter and column names in the SDDS dataset.

◆ sddsdata_SetParameter()

static PyObject * sddsdata_SetParameter ( PyObject * self,
PyObject * args )
static

Sets a parameter value in a dataset by index or name.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • indexOrName: Index or name of the parameter.
  • v: Value to set.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 2577 of file sddsdatamodule.c.

2578{
2579 long fileIndex;
2580 PyObject *indexOrName;
2581 PyObject *v;
2582 long index;
2583 long type;
2584 if (!PyArg_ParseTuple(args, "lOO", &fileIndex, &indexOrName, &v)) {
2585 return NULL;
2586 }
2587 if (PyString_Check(indexOrName)) {
2588 index = SDDS_GetParameterIndex(&dataset_f[fileIndex], PyString_AsString(indexOrName));
2589 } else if (PyNumber_Check(indexOrName)) {
2590 if (PyInt_Check(indexOrName))
2591 index = PyInt_AsLong(indexOrName);
2592 else if (PyLong_Check(indexOrName))
2593 index = PyLong_AsLong(indexOrName);
2594 else
2595 return NULL;
2596 } else
2597 return NULL;
2598 if ((type = SDDS_GetParameterType(&dataset_f[fileIndex], index)) == 0)
2599 return NULL;
2600 switch (type) {
2601 case SDDS_SHORT:
2602 case SDDS_USHORT:
2603 case SDDS_LONG:
2604 if (PyLong_Check(v)) {
2605 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsLong(v),-1));
2606 } else {
2607 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsLong(v),-1));
2608 }
2609 case SDDS_ULONG:
2610 if (PyLong_Check(v)) {
2611 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsUnsignedLong(v),-1));
2612 } else {
2613 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsUnsignedLong(v),-1));
2614 }
2615 case SDDS_LONG64:
2616 if (PyLong_Check(v)) {
2617 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsLongLong(v),-1));
2618 } else {
2619 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsLongLong(v),-1));
2620 }
2621 case SDDS_ULONG64:
2622 if (PyLong_Check(v)) {
2623 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyLong_AsUnsignedLongLong(v),-1));
2624 } else {
2625 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyInt_AsUnsignedLongLong(v),-1));
2626 }
2627 case SDDS_FLOAT:
2628 case SDDS_DOUBLE:
2629 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyFloat_AsDouble(v),-1));
2630 case SDDS_CHARACTER:
2631 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,(char)(PyString_AsString(v)[0]),-1));
2632 case SDDS_STRING:
2633 return PyLong_FromLong(SDDS_SetParameters(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,index,PyString_AsString(v),-1));
2634 }
2635 return PyLong_FromLong(0);
2636}
int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode,...)

◆ sddsdata_SetRowFlags()

static PyObject * sddsdata_SetRowFlags ( PyObject * self,
PyObject * args )
static

Sets the row flags for the dataset.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • row_flag_value (long): Flag value (valid values: 0, 1).
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 1197 of file sddsdatamodule.c.

1198{
1199 long fileIndex;
1200 long row_flag_value;
1201 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &row_flag_value)) {
1202 return NULL;
1203 }
1204 return PyLong_FromLong(SDDS_SetRowFlags(&dataset_f[fileIndex], row_flag_value));
1205}
int32_t SDDS_SetRowFlags(SDDS_DATASET *SDDS_dataset, int32_t row_flag_value)
Sets the acceptance flags for all rows in the current data table of a data set.

◆ sddsdata_SetRowMajorOrder()

static PyObject * sddsdata_SetRowMajorOrder ( PyObject * self,
PyObject * args )
static

Sets the data order for the SDDS dataset to row-major.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
Returns
PyObject*
  • Py_None (Python's None).

Definition at line 195 of file sddsdatamodule.c.

196{
197 long fileIndex;
198 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
199 return NULL;
200 }
201 dataset_f[fileIndex].layout.data_mode.column_major = 0;
202 return Py_None;
203}

◆ sddsdata_SetRowValues()

static PyObject * sddsdata_SetRowValues ( PyObject * self,
PyObject * args )
static

Sets values for a specific row in a dataset.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndex: Index of the dataset file.
  • row: Row number to set values for.
  • v: List of column-value pairs (alternating column name and value).
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 3015 of file sddsdatamodule.c.

3016{
3017 long fileIndex;
3018 long row, elements;
3019 PyObject *v;
3020 long type;
3021 long i;
3022 long index;
3023 PyObject *temp;
3024 if (!PyArg_ParseTuple(args, "llO", &fileIndex, &row, &v)) {
3025 return NULL;
3026 }
3027 elements = (long)PyList_Size(v);
3028 for (i=0; i<elements; i=i+2) {
3029 index = SDDS_GetColumnIndex(&dataset_f[fileIndex], PyString_AsString(PyList_GetItem(v, i)));
3030 temp = PyList_GetItem(v, i+1);
3031 if ((type = SDDS_GetColumnType(&dataset_f[fileIndex], index)) == 0)
3032 return NULL;
3033 switch (type) {
3034 case SDDS_SHORT:
3035 case SDDS_USHORT:
3036 case SDDS_LONG:
3037 if (PyLong_Check(temp)) {
3038 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsLong(temp),-1) == 0)
3039 return NULL;
3040 } else {
3041 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsLong(temp),-1) == 0)
3042 return NULL;
3043 }
3044 break;
3045 case SDDS_ULONG:
3046 if (PyLong_Check(temp)) {
3047 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsUnsignedLong(temp),-1) == 0)
3048 return NULL;
3049 } else {
3050 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsUnsignedLong(temp),-1) == 0)
3051 return NULL;
3052 }
3053 break;
3054 case SDDS_LONG64:
3055 if (PyLong_Check(temp)) {
3056 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsLongLong(temp),-1) == 0)
3057 return NULL;
3058 } else {
3059 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsLongLong(temp),-1) == 0)
3060 return NULL;
3061 }
3062 break;
3063 case SDDS_ULONG64:
3064 if (PyLong_Check(temp)) {
3065 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyLong_AsUnsignedLongLong(temp),-1) == 0)
3066 return NULL;
3067 } else {
3068 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyInt_AsUnsignedLongLong(temp),-1) == 0)
3069 return NULL;
3070 }
3071 break;
3072 case SDDS_FLOAT:
3073 case SDDS_DOUBLE:
3074 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyFloat_AsDouble(temp),-1) == 0)
3075 return NULL;
3076 break;
3077 case SDDS_CHARACTER:
3078 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,(char)(PyString_AsString(temp)[0]),-1) == 0)
3079 return NULL;
3080 break;
3081 case SDDS_STRING:
3082 if (SDDS_SetRowValues(&dataset_f[fileIndex],SDDS_SET_BY_INDEX|SDDS_PASS_BY_VALUE,row,index,PyString_AsString(temp),-1) == 0)
3083 return NULL;
3084 break;
3085 }
3086 }
3087 return PyLong_FromLong(1);
3088}
int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row,...)

◆ sddsdata_SetTerminateMode()

static PyObject * sddsdata_SetTerminateMode ( PyObject * self,
PyObject * args )
static

Sets the termination mode for SDDS to avoid freeing strings in arrays and tables.

Sets the termination mode to TERMINATE_DONT_FREE_ARRAY_STRINGS and TERMINATE_DONT_FREE_TABLE_STRINGS.

Parameters
selfUnused pointer to the module object.
argsUnused.
Returns
PyObject*
  • Py_None (Python's None).

Definition at line 277 of file sddsdatamodule.c.

278{
279 SDDS_SetTerminateMode(TERMINATE_DONT_FREE_TABLE_STRINGS+TERMINATE_DONT_FREE_ARRAY_STRINGS);
280 Py_INCREF(Py_None);
281 return Py_None;
282}
void SDDS_SetTerminateMode(uint32_t mode)

◆ sddsdata_StartPage()

static PyObject * sddsdata_StartPage ( PyObject * self,
PyObject * args )
static

Starts a page in an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
  • expected_n_rows (long): Expected number of rows on the page.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 972 of file sddsdatamodule.c.

973{
974 long fileIndex;
975 long expected_n_rows;
976 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &expected_n_rows)) {
977 return NULL;
978 }
979 return PyLong_FromLong(SDDS_StartPage(&dataset_f[fileIndex], expected_n_rows));
980}
int32_t SDDS_StartPage(SDDS_DATASET *SDDS_dataset, int64_t expected_n_rows)

◆ sddsdata_StringIsBlank()

static PyObject * sddsdata_StringIsBlank ( PyObject * self,
PyObject * args )
static

Checks if a string is blank.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • s (char*): String to check.
Returns
Python integer (1 if true, 0 otherwise).

Definition at line 2209 of file sddsdatamodule.c.

2210{
2211 char *s;
2212 if (!PyArg_ParseTuple(args, "s", &s)) {
2213 return NULL;
2214 }
2215 return PyLong_FromLong(SDDS_StringIsBlank(s));
2216}
int32_t SDDS_StringIsBlank(char *s)
Checks if a string is blank (contains only whitespace characters).

◆ sddsdata_Terminate()

static PyObject * sddsdata_Terminate ( PyObject * self,
PyObject * args )
static

Terminates an SDDS dataset, releasing any associated resources.

Parameters
selfUnused pointer to the module object.
argsPython tuple containing:
  • fileIndex (long): Index of the dataset in the array.
Returns
PyObject*
  • 1 on success.
  • 0 on error.

Definition at line 256 of file sddsdatamodule.c.

257{
258 long fileIndex;
259 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
260 return NULL;
261 }
262 return PyLong_FromLong(SDDS_Terminate(&dataset_f[fileIndex]));
263}
int32_t SDDS_Terminate(SDDS_DATASET *SDDS_dataset)

◆ sddsdata_TransferAllArrayDefinitions()

static PyObject * sddsdata_TransferAllArrayDefinitions ( PyObject * self,
PyObject * args )
static

Transfers all array definitions from one dataset to another.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • mode (long): Transfer mode. Valid values: 0, 1, 2, 3.
Returns
Python integer (1 on success, 0 on error).

Definition at line 1705 of file sddsdatamodule.c.

1706{
1707 long fileIndexTarget;
1708 long fileIndexSource;
1709 long mode;
1710 if (!PyArg_ParseTuple(args, "lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1711 return NULL;
1712 }
1713 return PyLong_FromLong(SDDS_TransferAllArrayDefinitions(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], mode));
1714}
int32_t SDDS_TransferAllArrayDefinitions(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
Transfers all array definitions from a source dataset to a target dataset.

◆ sddsdata_TransferAllColumnDefinitions()

static PyObject * sddsdata_TransferAllColumnDefinitions ( PyObject * self,
PyObject * args )
static

Transfers all column definitions from one dataset to another.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • mode (long): Transfer mode. Valid values: 0, 1, 2, 3.
Returns
Python integer (1 on success, 0 on error).

Definition at line 1684 of file sddsdatamodule.c.

1685{
1686 long fileIndexTarget;
1687 long fileIndexSource;
1688 long mode;
1689 if (!PyArg_ParseTuple(args, "lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1690 return NULL;
1691 }
1692 return PyLong_FromLong(SDDS_TransferAllColumnDefinitions(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], mode));
1693}
int32_t SDDS_TransferAllColumnDefinitions(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
Transfers all column definitions from a source dataset to a target dataset.

◆ sddsdata_TransferAllParameterDefinitions()

static PyObject * sddsdata_TransferAllParameterDefinitions ( PyObject * self,
PyObject * args )
static

Transfers all parameter definitions from one dataset to another.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • mode (long): Transfer mode. Valid values: 0, 1, 2, 3.
Returns
Python integer (1 on success, 0 on error).

Definition at line 1726 of file sddsdatamodule.c.

1727{
1728 long fileIndexTarget;
1729 long fileIndexSource;
1730 long mode;
1731 if (!PyArg_ParseTuple(args, "lll", &fileIndexTarget, &fileIndexSource, &mode)) {
1732 return NULL;
1733 }
1734 return PyLong_FromLong(SDDS_TransferAllParameterDefinitions(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], mode));
1735}
int32_t SDDS_TransferAllParameterDefinitions(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source, uint32_t mode)
Transfers all parameter definitions from a source dataset to a target dataset.

◆ sddsdata_TransferArrayDefinition()

static PyObject * sddsdata_TransferArrayDefinition ( PyObject * self,
PyObject * args )
static

Transfers an array definition from one dataset to another.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • name (char*): Name of the array to transfer.
  • newName (char*): New name for the array (optional).
Returns
Python integer (1 on success, 0 on error).

Definition at line 1593 of file sddsdatamodule.c.

1594{
1595 long fileIndexTarget;
1596 long fileIndexSource;
1597 char *name;
1598 char *newName;
1599 if (!PyArg_ParseTuple(args, "llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1600 return NULL;
1601 }
1602 return PyLong_FromLong(SDDS_TransferArrayDefinition(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], name, newName));
1603}
int32_t SDDS_TransferArrayDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers an array definition from a source dataset to a target dataset.

◆ sddsdata_TransferColumnDefinition()

static PyObject * sddsdata_TransferColumnDefinition ( PyObject * self,
PyObject * args )
static

Transfers a column definition from one dataset to another.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • name (char*): Name of the column to transfer.
  • newName (char*): New name for the column (optional).
Returns
Python integer (1 on success, 0 on error).

Definition at line 1570 of file sddsdatamodule.c.

1571{
1572 long fileIndexTarget;
1573 long fileIndexSource;
1574 char *name;
1575 char *newName;
1576 if (!PyArg_ParseTuple(args, "llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1577 return NULL;
1578 }
1579 return PyLong_FromLong(SDDS_TransferColumnDefinition(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], name, newName));
1580}
int32_t SDDS_TransferColumnDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers a column definition from a source dataset to a target dataset.

◆ sddsdata_TransferParameterDefinition()

static PyObject * sddsdata_TransferParameterDefinition ( PyObject * self,
PyObject * args )
static

Transfers a parameter definition from one dataset to another.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • fileIndexTarget (long): Target dataset index.
  • fileIndexSource (long): Source dataset index.
  • name (char*): Name of the parameter to transfer.
  • newName (char*): New name for the parameter (optional).
Returns
Python integer (1 on success, 0 on error).

Definition at line 1616 of file sddsdatamodule.c.

1617{
1618 long fileIndexTarget;
1619 long fileIndexSource;
1620 char *name;
1621 char *newName;
1622 if (!PyArg_ParseTuple(args, "llss", &fileIndexTarget, &fileIndexSource, &name, &newName)) {
1623 return NULL;
1624 }
1625 return PyLong_FromLong(SDDS_TransferParameterDefinition(&dataset_f[fileIndexTarget], &dataset_f[fileIndexSource], name, newName));
1626}
int32_t SDDS_TransferParameterDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers a parameter definition from a source dataset to a target dataset.

◆ sddsdata_UpdatePage()

static PyObject * sddsdata_UpdatePage ( PyObject * self,
PyObject * args )
static

Updates the page based on the specified mode.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
  • mode (long): Update mode.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 1051 of file sddsdatamodule.c.

1052{
1053 long fileIndex, mode;
1054 if (!PyArg_ParseTuple(args, "ll", &fileIndex, &mode)) {
1055 return NULL;
1056 }
1057 return PyLong_FromLong(SDDS_UpdatePage(&dataset_f[fileIndex], mode));
1058}
int32_t SDDS_UpdatePage(SDDS_DATASET *SDDS_dataset, uint32_t mode)
Updates the current page of the SDDS dataset.

◆ sddsdata_Warning()

static PyObject * sddsdata_Warning ( PyObject * self,
PyObject * args )
static

Displays a warning message on stderr.

Parameters
selfPython object (unused).
argsPython tuple containing:
  • message (char*): Warning message to display.
Returns
Python None, or NULL on error.

Definition at line 1510 of file sddsdatamodule.c.

1511{
1512 char *message;
1513 if (!PyArg_ParseTuple(args, "s", &message)) {
1514 return NULL;
1515 }
1516 SDDS_Warning(message);
1517 Py_INCREF(Py_None);
1518 return Py_None;
1519}
void SDDS_Warning(char *message)
Prints a warning message to stderr.
Definition SDDS_utils.c:362

◆ sddsdata_WriteLayout()

static PyObject * sddsdata_WriteLayout ( PyObject * self,
PyObject * args )
static

Writes the layout of an SDDS dataset.

Parameters
selfUnused.
argsA tuple containing:
  • fileIndex (long): Index of the dataset.
Returns
PyObject* A Python integer (1 on success, 0 on error).

Definition at line 598 of file sddsdatamodule.c.

599{
600 long fileIndex;
601 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
602 return NULL;
603 }
604 return PyLong_FromLong(SDDS_WriteLayout(&dataset_f[fileIndex]));
605}
int32_t SDDS_WriteLayout(SDDS_DATASET *SDDS_dataset)
Writes the SDDS layout header to the output file.

◆ sddsdata_WritePage()

static PyObject * sddsdata_WritePage ( PyObject * self,
PyObject * args )
static

Writes the current page of the dataset to the file.

Parameters
selfPointer to the Python self object.
argsTuple containing:
  • fileIndex (long): Index of the file dataset.
Returns
PyObject*:
  • 0 on error.
  • 1 on success.

Definition at line 1031 of file sddsdatamodule.c.

1032{
1033 long fileIndex;
1034 if (!PyArg_ParseTuple(args, "l", &fileIndex)) {
1035 return NULL;
1036 }
1037 return PyLong_FromLong(SDDS_WritePage(&dataset_f[fileIndex]));
1038}
int32_t SDDS_WritePage(SDDS_DATASET *SDDS_dataset)
Writes the current data table to the output file.

Variable Documentation

◆ _state

struct module_state _state
static

Definition at line 3565 of file sddsdatamodule.c.

◆ dataset_f

SDDS_DATASET dataset_f[20]

Array of SDDS dataset structures.

This array maintains a collection of SDDS_DATASET structures that correspond to files being managed by the SDDS library.

Definition at line 35 of file sddsdatamodule.c.

◆ sddsdata_methods

PyMethodDef sddsdata_methods[]
static

Definition at line 3568 of file sddsdatamodule.c.

3568 {
3569 { "InitializeInput", sddsdata_InitializeInput, METH_VARARGS },
3570 { "InitializeAppend", sddsdata_InitializeAppend, METH_VARARGS },
3571 { "InitializeAppendToPage", sddsdata_InitializeAppendToPage, METH_VARARGS },
3572 { "InitializeOutput", sddsdata_InitializeOutput, METH_VARARGS },
3573 { "SetColumnMajorOrder", sddsdata_SetColumnMajorOrder, METH_VARARGS },
3574 { "SetRowMajorOrder", sddsdata_SetRowMajorOrder, METH_VARARGS },
3575 { "SetFixedRowCountMode", sddsdata_SetFixedRowCountMode, METH_VARARGS },
3576 { "EnableFSync", sddsdata_EnableFSync, METH_VARARGS },
3577 { "DisableFSync", sddsdata_DisableFSync, METH_VARARGS },
3578 { "Terminate", sddsdata_Terminate, METH_VARARGS },
3579 { "SetTerminateMode", sddsdata_SetTerminateMode, METH_VARARGS },
3580 { "DefineParameter", sddsdata_DefineParameter, METH_VARARGS },
3581 { "DefineArray", sddsdata_DefineArray, METH_VARARGS },
3582 { "DefineColumn", sddsdata_DefineColumn, METH_VARARGS },
3583 { "IsValidName", sddsdata_IsValidName, METH_VARARGS },
3584 { "SetNameValidityFlags", sddsdata_SetNameValidityFlags, METH_VARARGS },
3585 { "DefineSimpleColumn", sddsdata_DefineSimpleColumn, METH_VARARGS },
3586 { "DefineSimpleArray", sddsdata_DefineSimpleArray, METH_VARARGS },
3587 { "DefineSimpleParameter", sddsdata_DefineSimpleParameter, METH_VARARGS },
3588 { "WriteLayout", sddsdata_WriteLayout, METH_VARARGS },
3589 { "EraseData", sddsdata_EraseData, METH_VARARGS },
3590 { "ProcessColumnString", sddsdata_ProcessColumnString, METH_VARARGS },
3591 { "ProcessArrayString", sddsdata_ProcessArrayString, METH_VARARGS },
3592 { "ProcessParameterString", sddsdata_ProcessParameterString, METH_VARARGS },
3593 { "InitializeCopy", sddsdata_InitializeCopy, METH_VARARGS },
3594 { "CopyLayout", sddsdata_CopyLayout, METH_VARARGS },
3595 { "AppendLayout", sddsdata_AppendLayout, METH_VARARGS },
3596 { "CopyPage", sddsdata_CopyPage, METH_VARARGS },
3597 { "CopyParameters", sddsdata_CopyParameters, METH_VARARGS },
3598 { "CopyArrays", sddsdata_CopyArrays, METH_VARARGS },
3599 { "CopyColumns", sddsdata_CopyColumns, METH_VARARGS },
3600 { "CopyRow", sddsdata_CopyRow, METH_VARARGS },
3601 { "CopyRowDirect", sddsdata_CopyRowDirect, METH_VARARGS },
3602 { "CopyAdditionalRows", sddsdata_CopyAdditionalRows, METH_VARARGS },
3603 { "DeferSavingLayout", sddsdata_DeferSavingLayout, METH_VARARGS },
3604 { "SaveLayout", sddsdata_SaveLayout, METH_VARARGS },
3605 { "RestoreLayout", sddsdata_RestoreLayout, METH_VARARGS },
3606 { "StartPage", sddsdata_StartPage, METH_VARARGS },
3607 { "ClearPage", sddsdata_ClearPage, METH_VARARGS },
3608 { "LengthenTable", sddsdata_LengthenTable, METH_VARARGS },
3609 { "WritePage", sddsdata_WritePage, METH_VARARGS },
3610 { "UpdatePage", sddsdata_UpdatePage, METH_VARARGS },
3611 { "InitHeaderlessInput", sddsdata_InitHeaderlessInput, METH_VARARGS },
3612 { "ReadPage", sddsdata_ReadPage, METH_VARARGS },
3613 { "ReadPageSparse", sddsdata_ReadPageSparse, METH_VARARGS },
3614 { "ReadPageLastRows", sddsdata_ReadPageLastRows, METH_VARARGS },
3615 { "RowCount", sddsdata_RowCount, METH_VARARGS },
3616 { "SetColumnFlags", sddsdata_SetColumnFlags, METH_VARARGS },
3617 { "SetRowFlags", sddsdata_SetRowFlags, METH_VARARGS },
3618 { "GetRowFlag", sddsdata_GetRowFlag, METH_VARARGS },
3619 { "DeleteColumn", sddsdata_DeleteColumn, METH_VARARGS },
3620 { "DeleteParameter", sddsdata_DeleteParameter, METH_VARARGS },
3621 { "DeleteUnsetColumns", sddsdata_DeleteUnsetColumns, METH_VARARGS },
3622 { "DeleteUnsetRows", sddsdata_DeleteUnsetRows, METH_VARARGS },
3623 { "ColumnCount", sddsdata_ColumnCount, METH_VARARGS },
3624 { "ArrayCount", sddsdata_ArrayCount, METH_VARARGS },
3625 { "ParameterCount", sddsdata_ParameterCount, METH_VARARGS },
3626 { "GetDescription", sddsdata_GetDescription, METH_VARARGS },
3627 { "GetDescriptionText", sddsdata_GetDescriptionText, METH_VARARGS },
3628 { "GetDescriptionContents", sddsdata_GetDescriptionContents, METH_VARARGS },
3629 { "NumberOfErrors", sddsdata_NumberOfErrors, METH_VARARGS },
3630 { "ClearErrors", sddsdata_ClearErrors, METH_VARARGS },
3631 { "SetError", sddsdata_SetError, METH_VARARGS },
3632 { "Bomb", sddsdata_Bomb, METH_VARARGS },
3633 { "Warning", sddsdata_Warning, METH_VARARGS },
3634 { "RegisterProgramName", sddsdata_RegisterProgramName, METH_VARARGS },
3635 { "PrintErrors", sddsdata_PrintErrors, METH_VARARGS },
3636 { "TransferColumnDefinition", sddsdata_TransferColumnDefinition, METH_VARARGS },
3637 { "TransferArrayDefinition", sddsdata_TransferArrayDefinition, METH_VARARGS },
3638 { "TransferParameterDefinition", sddsdata_TransferParameterDefinition, METH_VARARGS },
3639 { "DefineColumnLikeParameter", sddsdata_DefineColumnLikeParameter, METH_VARARGS },
3640 { "DefineParameterLikeColumn", sddsdata_DefineParameterLikeColumn, METH_VARARGS },
3641 { "TransferAllColumnDefinitions", sddsdata_TransferAllColumnDefinitions, METH_VARARGS },
3642 { "TransferAllArrayDefinitions", sddsdata_TransferAllArrayDefinitions, METH_VARARGS },
3643 { "TransferAllParameterDefinitions", sddsdata_TransferAllParameterDefinitions, METH_VARARGS },
3644 { "GetColumnIndex", sddsdata_GetColumnIndex, METH_VARARGS },
3645 { "GetArrayIndex", sddsdata_GetArrayIndex, METH_VARARGS },
3646 { "GetParameterIndex", sddsdata_GetParameterIndex, METH_VARARGS },
3647 { "GetColumnType", sddsdata_GetColumnType, METH_VARARGS },
3648 { "GetArrayType", sddsdata_GetArrayType, METH_VARARGS },
3649 { "GetNamedColumnType", sddsdata_GetNamedColumnType, METH_VARARGS },
3650 { "GetNamedArrayType", sddsdata_GetNamedArrayType, METH_VARARGS },
3651 { "GetColumnDefinition", sddsdata_GetColumnDefinition, METH_VARARGS },
3652 { "GetArrayDefinition", sddsdata_GetArrayDefinition, METH_VARARGS },
3653 { "GetParameterType", sddsdata_GetParameterType, METH_VARARGS },
3654 { "GetNamedParameterType", sddsdata_GetNamedParameterType, METH_VARARGS },
3655 { "GetParameterDefinition", sddsdata_GetParameterDefinition, METH_VARARGS },
3656 { "GetTypeSize", sddsdata_GetTypeSize, METH_VARARGS },
3657 { "GetTypeName", sddsdata_GetTypeName, METH_VARARGS },
3658 { "IdentifyType", sddsdata_IdentifyType, METH_VARARGS },
3659 { "CheckColumn", sddsdata_CheckColumn, METH_VARARGS },
3660 { "CheckArray", sddsdata_CheckArray, METH_VARARGS },
3661 { "CheckParameter", sddsdata_CheckParameter, METH_VARARGS },
3662 { "HasWhitespace", sddsdata_HasWhitespace, METH_VARARGS },
3663 { "StringIsBlank", sddsdata_StringIsBlank, METH_VARARGS },
3664 { "ApplyFactorToParameter", sddsdata_ApplyFactorToParameter, METH_VARARGS },
3665 { "ApplyFactorToColumn", sddsdata_ApplyFactorToColumn, METH_VARARGS },
3666 { "DeleteParameterFixedValues", sddsdata_DeleteParameterFixedValues, METH_VARARGS },
3667 { "SetDataMode", sddsdata_SetDataMode, METH_VARARGS },
3668 { "CheckDataset", sddsdata_CheckDataset, METH_VARARGS },
3669 { "SetAutoCheckMode", sddsdata_SetAutoCheckMode, METH_VARARGS },
3670 { "GetColumnNameFromIndex", sddsdata_GetColumnNameFromIndex, METH_VARARGS },
3671 { "GetColumnNames", sddsdata_GetColumnNames, METH_VARARGS },
3672 { "GetArrayNameFromIndex", sddsdata_GetArrayNameFromIndex, METH_VARARGS },
3673 { "GetArrayNames", sddsdata_GetArrayNames, METH_VARARGS },
3674 { "GetParameterNameFromIndex", sddsdata_GetParameterNameFromIndex, METH_VARARGS },
3675 { "GetParameterNames", sddsdata_GetParameterNames, METH_VARARGS },
3676 { "SetParameter", sddsdata_SetParameter, METH_VARARGS },
3677 { "SetColumn", sddsdata_SetColumn, METH_VARARGS },
3678 { "SetArray", sddsdata_SetArray, METH_VARARGS },
3679 { "SetRowValues", sddsdata_SetRowValues, METH_VARARGS },
3680 { "GetColumn", sddsdata_GetColumn, METH_VARARGS },
3681 { "GetArray", sddsdata_GetArray, METH_VARARGS },
3682 { "GetArrayDimensions", sddsdata_GetArrayDimensions, METH_VARARGS },
3683 { "GetParameter", sddsdata_GetParameter, METH_VARARGS },
3684 { "GetMode", sddsdata_GetMode, METH_VARARGS },
3685 { NULL, NULL }
3686};
static PyObject * sddsdata_GetMode(PyObject *self, PyObject *args)
Retrieves the data mode of a dataset.
static PyObject * sddsdata_GetArrayNames(PyObject *self, PyObject *args)
Retrieves all array names from a dataset.
static PyObject * sddsdata_ApplyFactorToColumn(PyObject *self, PyObject *args)
Applies a scaling factor to a column in a dataset.
static PyObject * sddsdata_GetNamedColumnType(PyObject *self, PyObject *args)
Retrieves the type of a column by name in a dataset.
static PyObject * sddsdata_CopyRow(PyObject *self, PyObject *args)
Copies a row from one SDDS dataset to another.
static PyObject * sddsdata_SetArray(PyObject *self, PyObject *args)
Sets an array value in a dataset.
static PyObject * sddsdata_GetDescriptionText(PyObject *self, PyObject *args)
Retrieves the description text for a dataset.
static PyObject * sddsdata_ProcessColumnString(PyObject *self, PyObject *args)
Processes a column definition string.
static PyObject * sddsdata_EraseData(PyObject *self, PyObject *args)
Erases data from an SDDS dataset.
static PyObject * sddsdata_GetParameter(PyObject *self, PyObject *args)
Retrieves the value of a parameter from a dataset.
static PyObject * sddsdata_DeleteUnsetRows(PyObject *self, PyObject *args)
Deletes all unset rows in the dataset.
static PyObject * sddsdata_EnableFSync(PyObject *self, PyObject *args)
Enables filesystem synchronization (fsync) for an SDDS dataset.
static PyObject * sddsdata_GetColumnIndex(PyObject *self, PyObject *args)
Retrieves the index of a column in a dataset.
static PyObject * sddsdata_CopyArrays(PyObject *self, PyObject *args)
Copies arrays from one SDDS dataset to another.
static PyObject * sddsdata_InitializeCopy(PyObject *self, PyObject *args)
Initializes a copy from one SDDS dataset to another.
static PyObject * sddsdata_ProcessParameterString(PyObject *self, PyObject *args)
Processes a parameter definition string.
static PyObject * sddsdata_SetRowMajorOrder(PyObject *self, PyObject *args)
Sets the data order for the SDDS dataset to row-major.
static PyObject * sddsdata_ProcessArrayString(PyObject *self, PyObject *args)
Processes an array definition string.
static PyObject * sddsdata_HasWhitespace(PyObject *self, PyObject *args)
Determines if a string contains whitespace.
static PyObject * sddsdata_GetColumnNames(PyObject *self, PyObject *args)
Retrieves all column names from a dataset.
static PyObject * sddsdata_GetRowFlag(PyObject *self, PyObject *args)
Gets the flag value for a specific row in the dataset.
static PyObject * sddsdata_GetColumn(PyObject *self, PyObject *args)
Retrieves a column's data from a dataset.
static PyObject * sddsdata_TransferArrayDefinition(PyObject *self, PyObject *args)
Transfers an array definition from one dataset to another.
static PyObject * sddsdata_GetParameterNames(PyObject *self, PyObject *args)
Retrieves all parameter names from a dataset.
static PyObject * sddsdata_SetNameValidityFlags(PyObject *self, PyObject *args)
Sets name validity flags to allow any name.
static PyObject * sddsdata_TransferAllParameterDefinitions(PyObject *self, PyObject *args)
Transfers all parameter definitions from one dataset to another.
static PyObject * sddsdata_GetColumnDefinition(PyObject *self, PyObject *args)
Retrieves the definition of a column in a dataset.
static PyObject * sddsdata_GetNamedArrayType(PyObject *self, PyObject *args)
Retrieves the type of an array by name in a dataset.
static PyObject * sddsdata_GetDescription(PyObject *self, PyObject *args)
Gets the description (text and contents) of the dataset.
static PyObject * sddsdata_LengthenTable(PyObject *self, PyObject *args)
Lengthens the table by adding additional rows.
static PyObject * sddsdata_SetRowFlags(PyObject *self, PyObject *args)
Sets the row flags for the dataset.
static PyObject * sddsdata_CheckColumn(PyObject *self, PyObject *args)
Verifies the existence and type of a column in a dataset.
static PyObject * sddsdata_GetParameterNameFromIndex(PyObject *self, PyObject *args)
Retrieves a parameter name by its index from a dataset.
static PyObject * sddsdata_StartPage(PyObject *self, PyObject *args)
Starts a page in an SDDS dataset.
static PyObject * sddsdata_GetNamedParameterType(PyObject *self, PyObject *args)
Retrieves the type of a parameter by name in a dataset.
static PyObject * sddsdata_DefineSimpleParameter(PyObject *self, PyObject *args)
Defines a simple parameter in an SDDS dataset.
static PyObject * sddsdata_CopyLayout(PyObject *self, PyObject *args)
Copies the layout from one SDDS dataset to another.
static PyObject * sddsdata_InitializeInput(PyObject *self, PyObject *args)
Initializes an SDDS dataset for input from a file.
static PyObject * sddsdata_NumberOfErrors(PyObject *self, PyObject *args)
Returns the number of errors recorded.
static PyObject * sddsdata_SetParameter(PyObject *self, PyObject *args)
Sets a parameter value in a dataset by index or name.
static PyObject * sddsdata_InitializeAppend(PyObject *self, PyObject *args)
Initializes an SDDS dataset for appending data to a file.
static PyObject * sddsdata_DisableFSync(PyObject *self, PyObject *args)
Disables filesystem synchronization (fsync) for an SDDS dataset.
static PyObject * sddsdata_DefineParameterLikeColumn(PyObject *self, PyObject *args)
Defines a parameter in one dataset based on a column in another dataset.
static PyObject * sddsdata_ApplyFactorToParameter(PyObject *self, PyObject *args)
Applies a scaling factor to a parameter in a dataset.
static PyObject * sddsdata_SaveLayout(PyObject *self, PyObject *args)
Saves the layout of an SDDS dataset.
static PyObject * sddsdata_SetFixedRowCountMode(PyObject *self, PyObject *args)
Sets the row count mode for an SDDS dataset to fixed row count mode.
static PyObject * sddsdata_DeferSavingLayout(PyObject *self, PyObject *args)
Defers saving the layout of an SDDS dataset.
static PyObject * sddsdata_RestoreLayout(PyObject *self, PyObject *args)
Restores the layout of an SDDS dataset.
static PyObject * sddsdata_InitHeaderlessInput(PyObject *self, PyObject *args)
Initializes a headerless input for a dataset file.
static PyObject * sddsdata_ReadPageLastRows(PyObject *self, PyObject *args)
Reads the last rows of the current page from the dataset file.
static PyObject * sddsdata_Warning(PyObject *self, PyObject *args)
Displays a warning message on stderr.
static PyObject * sddsdata_TransferColumnDefinition(PyObject *self, PyObject *args)
Transfers a column definition from one dataset to another.
static PyObject * sddsdata_DeleteUnsetColumns(PyObject *self, PyObject *args)
Deletes all unset columns in the dataset.
static PyObject * sddsdata_CheckArray(PyObject *self, PyObject *args)
Verifies the existence and type of an array in a dataset.
static PyObject * sddsdata_SetColumnFlags(PyObject *self, PyObject *args)
Sets the column flags for the dataset.
static PyObject * sddsdata_GetArrayNameFromIndex(PyObject *self, PyObject *args)
Retrieves an array name by its index from a dataset.
static PyObject * sddsdata_SetTerminateMode(PyObject *self, PyObject *args)
Sets the termination mode for SDDS to avoid freeing strings in arrays and tables.
static PyObject * sddsdata_RowCount(PyObject *self, PyObject *args)
Gets the number of rows in the dataset.
static PyObject * sddsdata_ParameterCount(PyObject *self, PyObject *args)
Gets the count of parameters in the dataset.
static PyObject * sddsdata_GetParameterIndex(PyObject *self, PyObject *args)
Retrieves the index of a parameter in a dataset.
static PyObject * sddsdata_ReadPage(PyObject *self, PyObject *args)
Reads the current page from the dataset file.
static PyObject * sddsdata_DefineSimpleArray(PyObject *self, PyObject *args)
Defines a simple array in an SDDS dataset.
static PyObject * sddsdata_SetColumnMajorOrder(PyObject *self, PyObject *args)
Sets the data order for the SDDS dataset to column-major.
static PyObject * sddsdata_WritePage(PyObject *self, PyObject *args)
Writes the current page of the dataset to the file.
static PyObject * sddsdata_GetArray(PyObject *self, PyObject *args)
Retrieves an array's data from a dataset.
static PyObject * sddsdata_DeleteParameter(PyObject *self, PyObject *args)
Deletes a parameter from the dataset.
static PyObject * sddsdata_RegisterProgramName(PyObject *self, PyObject *args)
Registers a program name for use in error messages.
static PyObject * sddsdata_ClearPage(PyObject *self, PyObject *args)
Clears the current page in an SDDS dataset.
static PyObject * sddsdata_DeleteColumn(PyObject *self, PyObject *args)
Deletes a column from the dataset.
static PyObject * sddsdata_GetArrayType(PyObject *self, PyObject *args)
Retrieves the type of an array in a dataset.
static PyObject * sddsdata_SetColumn(PyObject *self, PyObject *args)
Sets a column value in a dataset.
static PyObject * sddsdata_AppendLayout(PyObject *self, PyObject *args)
Appends the layout of one SDDS dataset to another.
static PyObject * sddsdata_CopyPage(PyObject *self, PyObject *args)
Copies a page from one SDDS dataset to another.
static PyObject * sddsdata_ReadPageSparse(PyObject *self, PyObject *args)
Reads a sparse page from the dataset file.
static PyObject * sddsdata_CheckParameter(PyObject *self, PyObject *args)
Verifies the existence and type of a parameter in a dataset.
static PyObject * sddsdata_StringIsBlank(PyObject *self, PyObject *args)
Checks if a string is blank.
static PyObject * sddsdata_IdentifyType(PyObject *self, PyObject *args)
Identifies the SDDS data type for a given type name.
static PyObject * sddsdata_CopyRowDirect(PyObject *self, PyObject *args)
Directly copies a row from one SDDS dataset to another.
static PyObject * sddsdata_SetError(PyObject *self, PyObject *args)
Sets an error description.
static PyObject * sddsdata_GetTypeSize(PyObject *self, PyObject *args)
Retrieves the size of a given SDDS data type.
static PyObject * sddsdata_CopyAdditionalRows(PyObject *self, PyObject *args)
Copies additional rows from one SDDS dataset to another.
static PyObject * sddsdata_GetColumnNameFromIndex(PyObject *self, PyObject *args)
Retrieves a column name by its index from a dataset.
static PyObject * sddsdata_TransferParameterDefinition(PyObject *self, PyObject *args)
Transfers a parameter definition from one dataset to another.
static PyObject * sddsdata_GetArrayIndex(PyObject *self, PyObject *args)
Retrieves the index of an array in a dataset.
static PyObject * sddsdata_GetParameterType(PyObject *self, PyObject *args)
Retrieves the type of a parameter in a dataset.
static PyObject * sddsdata_SetDataMode(PyObject *self, PyObject *args)
Sets the data mode for a given dataset.
static PyObject * sddsdata_Bomb(PyObject *self, PyObject *args)
Displays a message on stderr and exits the program.
static PyObject * sddsdata_ArrayCount(PyObject *self, PyObject *args)
Gets the count of arrays in the dataset.
static PyObject * sddsdata_DefineColumn(PyObject *self, PyObject *args)
Defines a column in an SDDS dataset.
static PyObject * sddsdata_ColumnCount(PyObject *self, PyObject *args)
Gets the count of columns in the dataset.
static PyObject * sddsdata_DefineParameter(PyObject *self, PyObject *args)
Defines a parameter in an SDDS dataset.
static PyObject * sddsdata_SetRowValues(PyObject *self, PyObject *args)
Sets values for a specific row in a dataset.
static PyObject * sddsdata_GetArrayDefinition(PyObject *self, PyObject *args)
Retrieves the definition of an array in a dataset.
static PyObject * sddsdata_CopyParameters(PyObject *self, PyObject *args)
Copies parameters from one SDDS dataset to another.
static PyObject * sddsdata_DefineSimpleColumn(PyObject *self, PyObject *args)
Defines a simple column in an SDDS dataset.
static PyObject * sddsdata_GetArrayDimensions(PyObject *self, PyObject *args)
Retrieves the dimensions of an array in a dataset.
static PyObject * sddsdata_DefineArray(PyObject *self, PyObject *args)
Defines an array in an SDDS dataset.
static PyObject * sddsdata_CheckDataset(PyObject *self, PyObject *args)
Checks the validity of a dataset.
static PyObject * sddsdata_TransferAllArrayDefinitions(PyObject *self, PyObject *args)
Transfers all array definitions from one dataset to another.
static PyObject * sddsdata_PrintErrors(PyObject *self, PyObject *args)
Prints error messages based on the provided mode.
static PyObject * sddsdata_InitializeOutput(PyObject *self, PyObject *args)
Initializes an SDDS dataset for output to a file.
static PyObject * sddsdata_SetAutoCheckMode(PyObject *self, PyObject *args)
Sets the auto-check mode for datasets.
static PyObject * sddsdata_CopyColumns(PyObject *self, PyObject *args)
Copies columns from one SDDS dataset to another.
static PyObject * sddsdata_UpdatePage(PyObject *self, PyObject *args)
Updates the page based on the specified mode.
static PyObject * sddsdata_TransferAllColumnDefinitions(PyObject *self, PyObject *args)
Transfers all column definitions from one dataset to another.
static PyObject * sddsdata_WriteLayout(PyObject *self, PyObject *args)
Writes the layout of an SDDS dataset.
static PyObject * sddsdata_InitializeAppendToPage(PyObject *self, PyObject *args)
Initializes appending data to an existing SDDS page in a file.
static PyObject * sddsdata_DefineColumnLikeParameter(PyObject *self, PyObject *args)
Defines a column in one dataset based on a parameter in another dataset.
static PyObject * sddsdata_ClearErrors(PyObject *self, PyObject *args)
Clears all recorded errors.
static PyObject * sddsdata_IsValidName(PyObject *self, PyObject *args)
Validates a name for SDDS compatibility.
static PyObject * sddsdata_DeleteParameterFixedValues(PyObject *self, PyObject *args)
Deletes fixed parameter values for a given dataset.
static PyObject * sddsdata_GetColumnType(PyObject *self, PyObject *args)
Retrieves the type of a column in a dataset.
static PyObject * sddsdata_Terminate(PyObject *self, PyObject *args)
Terminates an SDDS dataset, releasing any associated resources.
static PyObject * sddsdata_GetDescriptionContents(PyObject *self, PyObject *args)
Retrieves the description contents for a dataset.
static PyObject * sddsdata_GetTypeName(PyObject *self, PyObject *args)
Retrieves the name of a given SDDS data type.
static PyObject * sddsdata_GetParameterDefinition(PyObject *self, PyObject *args)
Retrieves the definition of a parameter in a dataset.