-
Notifications
You must be signed in to change notification settings - Fork 0
/
Experiment.cpp
93 lines (72 loc) · 4.14 KB
/
Experiment.cpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright 2015 Eileen Mazzochette, et al <[email protected]>
*/
#include "StdAfx.h"
#include "Experiment.h"
Experiment::Experiment()
{
}
int Experiment::setUpDataOutput(void)
{
int result = dataManager.setUpDataWriters(dataOutputLocation, experimentTitle);
if (result == 0) {
dataManager.writeStringToDisk("Experiment Title", experimentTitle);
dataManager.writeStringToDisk("Experiment Mode", experimentMode);
dataManager.writeDoubleToDisk("Target Location", targetLocation*100);
dataManager.writeIntToDisk("Slide Number", slideNumber);
dataManager.writeIntToDisk("Experiment on this slide Number", experimentPerSlideNumber);
dataManager.writeIntToDisk("Pre-Stimulus Record Time", waitingBufferSize);
dataManager.writeIntToDisk("Post-Stimulus Record Time", postWaitingBufferSize);
dataManager.writeStringToDisk("Other Experiment Info", otherInfo);
dataManager.startNode("Worm Properties");
dataManager.writeStringToDisk("Worm Strain", wormProperties.wormStrain);
dataManager.writeStringToDisk("Worm Treatments", wormProperties.wormTreatments);
dataManager.writeStringToDisk("Worm Gender", wormProperties.wormGender);
dataManager.writeStringToDisk("Worm Age", wormProperties.wormAge);
dataManager.writeIntToDisk("Percent Agar", wormProperties.percentAgar);
dataManager.writeStringToDisk("Food Status", wormProperties.foodStatus);
dataManager.endNode();
dataManager.startNode("Cantilever Properties");
dataManager.writeStringToDisk("Serial Number", cantileverProperties.serialNumber);
dataManager.writeDoubleToDisk("Resonant Frequency", cantileverProperties.frequency);
dataManager.writeDoubleToDisk("Stiffness", cantileverProperties.stiffness);
dataManager.writeDoubleToDisk("Sensitivity", cantileverProperties.sensitivity);
dataManager.writeDoubleToDisk("P Parameter", cantileverProperties.P_parameter);
dataManager.writeDoubleToDisk("I Parameter", cantileverProperties.I_parameter);
dataManager.writeDoubleToDisk("D Parameter", cantileverProperties.D_parameter);
dataManager.writePointToDisk("Cantilever Position", cantileverProperties.positionInImageSpace);
//dataManager.writeIntToDisk("Cantliever Position y", cantileverProperties.positionInImageSpace.y);
dataManager.endNode();
dataManager.startNode("Reported FPGA Parameters");
dataManager.writeDoubleToDisk("P Parameter", reportedFPGAParameters.P_Parameter);
dataManager.writeDoubleToDisk("I Parameter", reportedFPGAParameters.I_Parameter);
dataManager.writeDoubleToDisk("D Parameter", reportedFPGAParameters.D_Parameter);
dataManager.writeDoubleToDisk("Clamp Mode Parameter", reportedFPGAParameters.clampModeParameter);
dataManager.writeDoubleToDisk("Trigger Mode Parameter", reportedFPGAParameters.triggerModeParameter);
dataManager.writeDoubleToDisk("Acquisition Frequency", reportedFPGAParameters.acquisitionFreqParameter);
dataManager.writeDoubleToDisk("Actuator Frequency", reportedFPGAParameters.actuatorFreqParameter);
dataManager.writeDoubleToDisk("Wave Table Present", reportedFPGAParameters.waveTablePresentParameter);
dataManager.endNode();
dataManager.startNode("Ambient Parameters");
dataManager.writeDoubleToDisk("Temperature", ambientParameters.temperature);
dataManager.writeDoubleToDisk("Humidity", ambientParameters.humidity);
dataManager.endNode();
}
stim.saveAsYAML(dataManager.stimDataFileName);
return result;
}
void Experiment::writeFrameToDisk(WormOutputData data)
{
dataManager.appendWormFrameToDisk(data, printOverlays);
}
void Experiment::writefpgaDataToDisk(int stimNum, vector<double> piezoSignalData, vector<double> actuatorPositionData, vector<double> actuatorCommandData, vector<double> desiredSignalData)
{
dataManager.writeStimulusDataToDisk(stimNum, piezoSignalData, actuatorPositionData, actuatorCommandData, desiredSignalData);
}
void Experiment::endExperiment(void)
{
dataManager.writeIntToDisk("Number Of Stimulus", stimulusNumber-1);
dataManager.writeStringToDisk("Post Experiment Notes", postExpNotes);
dataManager.writeStringToDisk("Timing Data", TICTOC::timer().generateReport());
dataManager.closeDataWriters();
}