SDDSlib
|
Functions and definitions for handling SDDS datasets and integrating with MPL (Matplotlib). More...
Go to the source code of this file.
Classes | |
struct | MATCH_TERM |
Macros | |
#define | COLUMN_BASED 0 |
#define | PARAMETER_BASED 1 |
#define | DATA_CLASS_KEYWORDS 2 |
#define | is_logic_character(c) |
Functions | |
int64_t | copy_doubles_with_sampling (double *target, double *source, int64_t source_points, int64_t sample_interval) |
Copies elements from the source array to the target array with sampling. | |
char * | delete_bounding_characters (char *s, char *t) |
Removes specified bounding characters from a string. | |
int32_t | process_match_requests (MATCH_TERM **column_match, MATCH_TERM **parameter_match, char *option_string) |
Processes match requests for columns and parameters based on an option string. | |
void | SDDS_PrintListOfColumns (SDDS_DATASET *SDDS_dataset, char *message, FILE *fp) |
Prints a list of columns in the SDDS dataset. | |
void | SDDS_PrintListOfParameters (SDDS_DATASET *SDDS_dataset, char *message, FILE *fp) |
Prints a list of parameters in the SDDS dataset. | |
int32_t | SDDS_ReadIntoMplTable (TABLE *mpl_data, char *file, int64_t sample_interval, int32_t mpl_flags, char *SDDS_tags) |
Reads SDDS data into an MPL-compatible table structure. | |
void | SDDS_FixMplName (char *name) |
Cleans and fixes an MPL-compatible name by removing specific sequences and extra spaces. | |
void | SDDS_ExtractNameAndUnit (char **name, char **unit, char *label) |
Extracts the name and unit from a labeled string. | |
int32_t | SDDS_AddMplDefinition (SDDS_DATASET *SDDS_dataset, char *label, char *suffix, char *default_name, char *filename) |
Adds an MPL-compatible column definition to an SDDS dataset. | |
int32_t | SDDS_WriteMplTable (TABLE *mpl_data, char *file) |
Writes an MPL-compatible table to an SDDS file. | |
Variables | |
static char * | data_class_keyword [DATA_CLASS_KEYWORDS] |
Functions and definitions for handling SDDS datasets and integrating with MPL (Matplotlib).
This file provides a collection of macros, type definitions, and functions designed to manipulate SDDS (Self Describing Data Sets) data structures for seamless integration with MPL (Matplotlib). The functionalities include data sampling, string manipulation, match processing, column and parameter handling, and writing MPL-compatible tables to SDDS files.
Definition in file SDDS_mplsupport.c.
#define COLUMN_BASED 0 |
Definition at line 29 of file SDDS_mplsupport.c.
#define DATA_CLASS_KEYWORDS 2 |
Definition at line 31 of file SDDS_mplsupport.c.
#define is_logic_character | ( | c | ) |
Definition at line 35 of file SDDS_mplsupport.c.
#define PARAMETER_BASED 1 |
Definition at line 30 of file SDDS_mplsupport.c.
int64_t copy_doubles_with_sampling | ( | double * | target, |
double * | source, | ||
int64_t | source_points, | ||
int64_t | sample_interval ) |
Copies elements from the source array to the target array with sampling.
This function copies elements from the source array to the target array, selecting every sample_interval
-th element from the source.
target | Pointer to the target array where sampled elements will be stored. |
source | Pointer to the source array from which elements are copied. |
source_points | Number of elements in the source array. |
sample_interval | Interval at which elements are sampled from the source. |
Definition at line 55 of file SDDS_mplsupport.c.
char * delete_bounding_characters | ( | char * | s, |
char * | t ) |
Removes specified bounding characters from a string.
This function trims characters specified in t
from both the beginning and the end of the string s
. It modifies the string s
in place and returns a pointer to it.
s | The string from which to remove bounding characters. |
t | A string containing characters to be removed from the start and end of s . |
s
. Definition at line 72 of file SDDS_mplsupport.c.
int32_t process_match_requests | ( | MATCH_TERM ** | column_match, |
MATCH_TERM ** | parameter_match, | ||
char * | option_string ) |
Processes match requests for columns and parameters based on an option string.
This function parses the option_string
to generate match criteria for columns and parameters. It populates the column_match
and parameter_match
arrays with the corresponding match terms.
column_match | Double pointer to an array of MATCH_TERM structures for columns. |
parameter_match | Double pointer to an array of MATCH_TERM structures for parameters. |
option_string | The string containing match options and criteria. |
Definition at line 116 of file SDDS_mplsupport.c.
int32_t SDDS_AddMplDefinition | ( | SDDS_DATASET * | SDDS_dataset, |
char * | label, | ||
char * | suffix, | ||
char * | default_name, | ||
char * | filename ) |
Adds an MPL-compatible column definition to an SDDS dataset.
This function defines a new column in the provided SDDS_dataset
based on the given label, suffix, and default name. It handles the extraction of the symbol and unit from the label, ensures that the column name is unique within the dataset, and appends the suffix to create the final column name.
SDDS_dataset | Pointer to the SDDS_DATASET structure where the column will be added. |
label | The label string containing the name and optionally the unit in the format "Name (Unit)". |
suffix | An optional suffix to append to the column name. Can be NULL if no suffix is needed. |
default_name | The default name to use if the label is blank. |
filename | The name of the file being processed, used for error reporting. |
-1
if an error occurs.Definition at line 764 of file SDDS_mplsupport.c.
void SDDS_ExtractNameAndUnit | ( | char ** | name, |
char ** | unit, | ||
char * | label ) |
Extracts the name and unit from a labeled string.
This function parses a label string to separate the name and its associated unit. It looks for the pattern " (unit)" within the label. If found, it splits the label into the name
and unit
components. The function also trims any trailing spaces from the name
.
name | Double pointer to a string where the extracted name will be stored. Memory is allocated internally. |
unit | Double pointer to a string where the extracted unit will be stored. Memory is allocated internally. If no unit is found, *unit is set to NULL . |
label | The input label string containing the name and optionally the unit in the format "Name (Unit)". |
*name
and *unit
if they are not NULL
. Definition at line 730 of file SDDS_mplsupport.c.
void SDDS_FixMplName | ( | char * | name | ) |
Cleans and fixes an MPL-compatible name by removing specific sequences and extra spaces.
This function iterates through the provided name
string and removes any occurrence of a dollar sign ('$') followed by specific characters (‘'a’,
'b',
'n',
'g',
'r',
's',
'e',
'd',
'i',
'v',
'u'`). Additionally, it removes any extra spaces within the string, ensuring that only single spaces remain between words.
name | A mutable string representing the name to be fixed. The string is modified in place. |
name
string is mutable and has sufficient space to handle in-place modifications. Definition at line 684 of file SDDS_mplsupport.c.
void SDDS_PrintListOfColumns | ( | SDDS_DATASET * | SDDS_dataset, |
char * | message, | ||
FILE * | fp ) |
Prints a list of columns in the SDDS dataset.
This function outputs the list of available columns in the provided SDDS dataset to the specified file pointer.
SDDS_dataset | Pointer to the SDDS_DATASET structure containing dataset information. |
message | A message to display before listing the columns. |
fp | File pointer where the list of columns will be printed. |
Definition at line 234 of file SDDS_mplsupport.c.
void SDDS_PrintListOfParameters | ( | SDDS_DATASET * | SDDS_dataset, |
char * | message, | ||
FILE * | fp ) |
Prints a list of parameters in the SDDS dataset.
This function outputs the list of available parameters in the provided SDDS dataset to the specified file pointer.
SDDS_dataset | Pointer to the SDDS_DATASET structure containing dataset information. |
message | A message to display before listing the parameters. |
fp | File pointer where the list of parameters will be printed. |
Definition at line 261 of file SDDS_mplsupport.c.
int32_t SDDS_ReadIntoMplTable | ( | TABLE * | mpl_data, |
char * | file, | ||
int64_t | sample_interval, | ||
int32_t | mpl_flags, | ||
char * | SDDS_tags ) |
Reads SDDS data into an MPL-compatible table structure.
This function initializes an SDDS dataset from the specified file, processes the data according to the provided sample interval and flags, and populates the mpl_data
table with the sampled data. It handles column and parameter-based matching as specified by SDDS_tags
.
mpl_data | Pointer to the TABLE structure where the SDDS data will be stored. |
file | The filename of the SDDS data file to read. |
sample_interval | The interval at which data points are sampled from the source. |
mpl_flags | Flags controlling the behavior of the MPL data processing. |
SDDS_tags | Optional tags specifying columns or parameters of interest. |
Definition at line 294 of file SDDS_mplsupport.c.
int32_t SDDS_WriteMplTable | ( | TABLE * | mpl_data, |
char * | file ) |
Writes an MPL-compatible table to an SDDS file.
This function initializes an SDDS output file, defines necessary columns based on the provided mpl_data
, and writes the data to the file. It handles optional sigma columns, ensures that the output file does not overwrite existing files by renaming them if necessary, and respects environment variables for output configuration.
mpl_data | Pointer to the TABLE structure containing MPL data to be written. |
file | The filename of the SDDS file where the data will be written. |
1
on successful writing of the MPL table, or 0
if an error occurs.Definition at line 813 of file SDDS_mplsupport.c.
|
static |
Definition at line 32 of file SDDS_mplsupport.c.