Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FSI Data Acquisition Path Gateware and Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
FSI Data Acquisition Path Gateware and Software
Commits
257a9e8c
Commit
257a9e8c
authored
Jul 22, 2021
by
Juan David Gonzalez Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add WIP definitions of data structures
parent
51d6cb1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
fsi.h
libfsi/fsi.h
+75
-0
No files found.
libfsi/fsi.h
0 → 100644
View file @
257a9e8c
/*
* Copyright CERN 2021
* Author: Juan David Gonzalez Cobas <dcobas _at_ cern.ch>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#ifndef FSI_LIB_H_
#define FSI_LIB_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
enum
fsi_peak_type
{
FSI_PEAK_LORENTZ
=
1
,
/**< Cauchy-Lorentz 1/(1+xˆ2) distribution */
FSI_PEAK_GAUSS
,
/**< Gaussian (normal) distribution */
FSI_PEAK_SINC
,
/**< Sinc (sin(x)/x)) distribution */
FSI_PEAK_MOFFAT
,
/**< Moffat (power of Cauchy pdf) distribution */
FSI_PEAK_BRAGG
,
/**< Bragg-type peak */
/* FIXME:should Bragg type be set apart? */
};
/* biggest number of model parameters among different peak types */
#define FSI_MAX_MODEL_PARAMS 4
/* max number of peaks to find in a channel sample */
#define FSI_MAX_PEAKS 5
/* length of return peak data */
#define FSI_PEAK_LENGTH 200
/* library error codes */
#define __FSI_ERR_START 1024
struct
fsi_peak_request
{
double
frequency
;
/**< estimated frequency where peak fits */
double
search_range
;
/**< estimated interval of peak range */
double
channel_gain
;
/**< FIXME: should be per-channel, not per-peak? */
enum
fsi_peak_type
type
;
/**< shape of peak to fit */
};
struct
fsi_peak_result
{
double
frequency
;
/**< center of peak fitted to data */
double
amplitude
;
/**< peak width derived from parameters */
double
snr
;
/**< peak signal-to-noise ratio (?) */
enum
fsi_peak_type
type
;
/**< shape of peak fit to data */
double
fit_params
[
FSI_MAX_MODEL_PARAMS
];
/**< goodness-of-fit params, model-dependent */
uint16_t
samples
[
FSI_PEAK_LENGTH
];
/**< actual peak samples */
};
struct
fsi_channel_request
{
unsigned
int
channel_id
;
/**< channel to be configured */
double
channel_gain
;
/**< channel gain FIXME: see fsi_peak_request */
int
npeaks
;
/**< number of valid peaks in peaks array */
struct
fsi_peak_request
peaks
[
FSI_MAX_PEAKS
];
/**< peak requests */
};
struct
fsi_channel_measurement
{
unsigned
int
channel_id
;
/**< channel measured here */
int
npeaks
;
/**< number of valid entries in peaks array */
struct
fsi_peak_result
peaks
[
FSI_MAX_PEAKS
];
/**< peam measured values */
};
#ifdef __cplusplus
}
#endif
#endif
/* FSI_LIB_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment