-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpolarizationAnalysisTools.h
More file actions
43 lines (41 loc) · 2.67 KB
/
Copy pathpolarizationAnalysisTools.h
File metadata and controls
43 lines (41 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
Program to record polarization.
RasPi connected to USB 1208LS.
Target energy: USB1208LS Analog out Ch1 controls HP3617A. See pg 31 my lab book
PMT Counts: data received from CTR in USB1208
*/
#define REVOLUTIONS 1
#define STEPSPERREV 1200
#define DATAPOINTSPERREV 30
#define DATAPOINTS (DATAPOINTSPERREV * REVOLUTIONS)
#define PI 3.14159265358979
#define NORMCURR 0 // Set this to 1 to normalize the intensity with the current
#define DWELL 1 // The number of seconds to pause, letting electronics settle
#define ALPHA 20.4 // The constant Alpha (location of transmission axis), measured in degrees.
#define DALPHA 0.1 // The uncertainty in ALPHA
#define BETA 68.7 // The constant Beta_0 (beginning position of QWP relative to positive x axis ) measured in degrees.
#define DBETA 0.1 // The uncertainty in BETA
#define DELTA 94.5 // The constant Delta (wave plate retardance) in degrees.
#define DDELTA 0.6 // The uncertainty in DELTA
#define DSTEP .5 // The uncertainty in the step size
#define NUMSTOKES 4
#define POS 0 // Used for my error array positive values are stored first.
#define NEG (DATAPOINTS/2)// Then negative values.
int calculateFourierCoefficients(char* fileName, int dataPointsPerRevolution, int Revolutions, int normalizeWithCurrent, float* fcCosRet, float* fcCosErrRet, float* fcSinRet, float* fcSinErrRet, float* avgCurrentReturn, float* avgCurrentStdDevReturn);
int calculateStokesFromFC(float* fcCos, float* fcCosErr, float* fcSin, float* fcSinErr, float* stokesReturn, float* stokesErrReturn);
int processFileWithBackground(char* analysisFileName, char* backgroundFileName, char* dataFile, int datapointsPerRevolution, int revolutions, int normalizeWithCurrent);
// Calculates the ith relative stokes parameter.
float calculateStokes(int i, float alpha, float beta, float delta, float c0, float c2, float c4, float s2, float s4);
int writeDataSummaryToFile(char* analysisFileName, char* backgroundFileName,char* rawDataFileName,
int normalizeWithCurrent, char* comments,
float* fcCos, float* fcCosErr, float* fcSin, float* fcSinErr,
float* stokesParameters, float* spError,
float avgCurrent, float avgCurrentStdDev);
int writeDataSummaryFileEntry(char* analysisFileName, char* backgroundFileName, char* dataFileName,
int normalizeWithCurrent, char* comments,
float* fcCos, float* fcCosErr, float* fcSin, float* fcSinErr,
float* stokesParameters, float* spErr,
float avgCurrent, float avgCurrentStdDev);
int writeDataSummaryFileColumnHeadings(char* analysisFileName);
int writeDataSummaryFileHeader(char* analysisFileName, char* backgroundFileName, char* dataFileName, char* comments);
int printOutSP(float* sp, float* spError);