-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding constrained sensing capabilities to the SPSL post processor. Added a test_SPSL_constrained xml for testing. #2346
base: devel
Are you sure you want to change the base?
Changes from 18 commits
5055f61
32f6a5c
8a1b5d5
66b4adf
226b5a8
53c72e3
3c19e83
9c435e0
a092359
047fdf1
357a16a
bd72312
4dbfa69
4a71208
5a55ae4
207b0cf
b59e4d0
d2dc13b
a288140
fb43bec
26284ee
3f7b970
60517e5
ef79d99
a4a1159
b6d4a9d
aa0a10a
b31c4fa
44b71f7
bf3d244
d09da7e
dbb792d
c6d40b4
4618f3d
0377df7
cfba5ed
8155b90
c06a2bb
9eaf38b
254895a
bf98b39
03428a5
4975ad8
7e12525
ad67ac2
995c889
f143170
d66eae9
21d686b
9e5835e
0b1b272
307dabe
6bcca52
a5b9be5
676fd20
99066b5
e3b6a09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Power (W),BCTemperature (K),filename | ||
350,240,350_240.csv | ||
350,270,350_270.csv | ||
350,300,350_300.csv | ||
350,330,350_330.csv |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sensor,Temperature (K),X (m),Y (m),label | ||
1,241.5795986,0.008141501,-0.098437689,<300 K | ||
2,242.5042687,0.004994706,0.072699441,<300 K | ||
3,240.1987226,0.037176882,0.140548347,<300 K | ||
4,244.1098113,0.003235497,-0.118483818,<300 K |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?xml version="1.0" ?> | ||
<Simulation verbosity="debug"> | ||
<TestInfo> | ||
<name>tests/framework/Postprocessors/SparseSensing</name> | ||
<author>Mohammad Abdo (@Jimmy-INL)</author> | ||
<created>2023-11-04</created> | ||
<classesTested>Models.Postprocessors.SparseSensing</classesTested> | ||
<description>This test aims to check the ability of the Sparse Sensing Postprocessor | ||
to locate and plot the selected sensors to reconstruct the temperature field of the OPTI-TWIST prototype | ||
when perturbing the heater power. | ||
</description> | ||
</TestInfo> | ||
|
||
<RunInfo> | ||
<WorkingDir>classificationOptiTwist</WorkingDir> | ||
<Sequence>LoadCSV, mySPpp, print</Sequence> | ||
<batchSize>1</batchSize> | ||
</RunInfo> | ||
|
||
<Files> | ||
<Input name="twistFile" type="">./Perturbations2.csv</Input> | ||
<Input name="refDO" type="">./350_330.csv</Input> | ||
</Files> | ||
|
||
<Steps> | ||
<IOStep name="LoadCSV"> | ||
<Input class="Files" type="">twistFile</Input> | ||
<Input class="Files" type="">refDO</Input> | ||
<Output class="DataObjects" type="HistorySet">TwistDO</Output> | ||
<Output class="DataObjects" type="PointSet">myDO</Output> | ||
</IOStep> | ||
<PostProcess name="mySPpp"> | ||
<Input class="DataObjects" type="HistorySet">TwistDO</Input> | ||
<Model class="Models" type="PostProcessor">mySPSL</Model> | ||
<Output class="DataObjects" type="DataSet">outPP</Output> | ||
</PostProcess> | ||
<IOStep name="print"> | ||
<Input class="DataObjects" type="DataSet">outPP</Input> | ||
<Input class="DataObjects" type="PointSet">myDO</Input> | ||
<Input class="DataObjects" type="HostorySet">TwistDO</Input> | ||
<Output class="OutStreams" type="Print">outPP</Output> | ||
<Output class="OutStreams" type="Plot">mySensorPlot</Output> | ||
<Output class="OutStreams" type="Plot">mySensorPlot3D</Output> | ||
</IOStep> | ||
</Steps> | ||
|
||
<Models> | ||
<PostProcessor name="mySPSL" subType="SparseSensing" verbosity="debug"> | ||
<Goal subType="classification"> | ||
<features>X (m),Y (m),Temperature (K), label</features> | ||
<measuredState>Temperature (K)</measuredState> | ||
<labels>label</labels> | ||
<basis>SVD</basis> | ||
<nModes>4</nModes> | ||
<nSensors>4</nSensors> | ||
<classifier>LDA</classifier> | ||
</Goal> | ||
</PostProcessor> | ||
</Models> | ||
|
||
<DataObjects> | ||
<PointSet name="myDO"> | ||
<Output>X (m),Temperature (K),Y (m), label</Output> | ||
</PointSet> | ||
<HistorySet name="TwistDO"> | ||
<Input> Power (W), BCTemperature (K)</Input> | ||
<Output>X (m),Temperature (K),Y (m), label</Output> | ||
<options> | ||
<pivotParameter>index</pivotParameter> | ||
</options> | ||
</HistorySet> | ||
<DataSet name="outPP"> | ||
<Input>InputPlaceHolder</Input> | ||
<Output>Temperature (K), X (m), Y (m), label</Output> | ||
<Index var="sensor">X (m),Y (m),Temperature (K), label</Index> | ||
</DataSet> | ||
</DataObjects> | ||
|
||
<OutStreams> | ||
<Print name="outPP"> | ||
<type>csv</type> | ||
<source>outPP</source> | ||
<what>output</what> | ||
</Print> | ||
<Plot name="mySensorPlot"> | ||
<plotSettings> | ||
<plot> | ||
<type>scatter</type> | ||
<x>myDO|Output|X (m)</x> | ||
<y>myDO|Output|Y (m)</y> | ||
<cmap>coolwarm</cmap> | ||
<colorMap>myDO|Output|Temperature (K)</colorMap> | ||
</plot> | ||
<plot> | ||
<type>scatter</type> | ||
<x>outPP|Output|X (m)</x> | ||
<y>outPP|Output|Y (m)</y> | ||
<c>black</c> | ||
<marker>x</marker> | ||
</plot> | ||
<xlabel>x</xlabel> | ||
<ylabel>y</ylabel> | ||
</plotSettings> | ||
<actions> | ||
<how>png</how> | ||
</actions> | ||
</Plot> | ||
|
||
<Plot name="mySensorPlot3D"> | ||
<plotSettings> | ||
<plot> | ||
<type>scatter</type> | ||
<x>TwistDO|Output|X (m)</x> | ||
<y>TwistDO|Output|Y (m)</y> | ||
<z>TwistDO|Output|Temperature (K)</z> | ||
<cmap>coolwarm</cmap> | ||
<colorMap>TwistDO|Output|Temperature (K)</colorMap> | ||
</plot> | ||
<xlabel>x</xlabel> | ||
<ylabel>y</ylabel> | ||
<zlabel>temperature (K)</zlabel> | ||
</plotSettings> | ||
<actions> | ||
<how>png</how> | ||
</actions> | ||
</Plot> | ||
</OutStreams> | ||
|
||
</Simulation> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<?xml version="1.0" ?> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file does not seem to be used in the tests yet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like new tests have been added, so maybe this file can be removed? |
||
<Simulation verbosity="debug"> | ||
<TestInfo> | ||
<name>tests/framework/Postprocessors/SparseSensing</name> | ||
<author>Niharika Karnik (@niharika2999), Mohammad Abdo (@Jimmy-INL)</author> | ||
<created>2024-04-01</created> | ||
<classesTested>Models.Postprocessors.SparseSensing</classesTested> | ||
<description>This test aims to check the ability of the Sparse Sensing Postprocessor | ||
to locate and plot the selected sensors to reconstruct the temperature field of the OPTI-TWIST prototype | ||
when perturbing the heater power in the presence of constraints. We assume the region near the heater to have very limited sensing capability and thus accomodate no sensors. | ||
</description> | ||
</TestInfo> | ||
|
||
<RunInfo> | ||
<WorkingDir>reconstructionConstraintsOptiTwist</WorkingDir> | ||
<Sequence>LoadCSV, mySPpp, print</Sequence> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @niharika2999 , the reason tests are failing is that the path is inconsistent. For instance, the working directory here is |
||
<batchSize>1</batchSize> | ||
</RunInfo> | ||
|
||
<Files> | ||
<Input name="twistFile" type="">./Perturbations2.csv</Input> | ||
<Input name="refDO" type="">./350_330.csv</Input> | ||
</Files> | ||
|
||
<Steps> | ||
<IOStep name="LoadCSV"> | ||
<Input class="Files" type="">twistFile</Input> | ||
<Input class="Files" type="">refDO</Input> | ||
<Output class="DataObjects" type="HistorySet">TwistDO</Output> | ||
<Output class="DataObjects" type="PointSet">myDO</Output> | ||
</IOStep> | ||
<PostProcess name="mySPpp"> | ||
<Input class="DataObjects" type="HistorySet">TwistDO</Input> | ||
<Model class="Models" type="PostProcessor">mySPSL</Model> | ||
<Output class="DataObjects" type="DataSet">outPP</Output> | ||
</PostProcess> | ||
<IOStep name="print"> | ||
<Input class="DataObjects" type="DataSet">outPP</Input> | ||
<Input class="DataObjects" type="PointSet">myDO</Input> | ||
<Input class="DataObjects" type="HistorySet">TwistDO</Input> | ||
<Output class="OutStreams" type="Print">outPP</Output> | ||
<Output class="OutStreams" type="Plot">mySensorPlot</Output> | ||
<Output class="OutStreams" type="Plot">mySensorPlot3D</Output> | ||
</IOStep> | ||
</Steps> | ||
|
||
<Models> | ||
<PostProcessor name="mySPSL" subType="SparseSensing" verbosity="debug"> | ||
<Goal subType="reconstruction"> | ||
<features>X (m),Y (m),Temperature (K)</features> ### Try removing features, get X, Y from user | ||
<measuredState>Temperature (K)</measuredState> | ||
<basis>SVD</basis> | ||
<nModes>4</nModes> | ||
<nSensors>4</nSensors> | ||
<nConstSensors>0</nConstSensors> | ||
<constraintOption>"exact_n"</constraintOption> | ||
<ConstrainedRegions type = "circle"> | ||
<center_x></center_x> #center coordinates instead (x,y) (r, \theta) | ||
<center_y></center_y> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comments in xml are done using |
||
<loc>'in'</loc> | ||
<radius></radius> | ||
</ConstrainedRegions> | ||
<optimizer>GQR</optimizer> | ||
</Goal> | ||
</PostProcessor> | ||
</Models> | ||
|
||
<DataObjects> | ||
<PointSet name="myDO"> | ||
<Output>X (m), Temperature (K),Y (m)</Output> | ||
</PointSet> | ||
<HistorySet name="TwistDO"> | ||
<Input> Power (W), BCTemperature (K)</Input> | ||
<Output>X (m), Temperature (K), Y (m)</Output> | ||
<options> | ||
<pivotParameter>index</pivotParameter> | ||
</options> | ||
</HistorySet> | ||
<DataSet name="outPP"> | ||
<Input>InputPlaceHolder</Input> | ||
<Output>Temperature (K), X (m), Y (m)</Output> | ||
<Index var="sensor">X (m), Y (m), Temperature (K)</Index> | ||
</DataSet> | ||
</DataObjects> | ||
|
||
<OutStreams> | ||
<Print name="outPP"> | ||
<type>csv</type> | ||
<source>outPP</source> | ||
<what>output</what> | ||
</Print> | ||
<Plot name="mySensorPlot"> | ||
<plotSettings> | ||
<plot> | ||
<type>scatter</type> | ||
<x>myDO|Output|X (m)</x> | ||
<y>myDO|Output|Y (m)</y> | ||
<cmap>coolwarm</cmap> | ||
<colorMap>myDO|Output|Temperature (K)</colorMap> | ||
</plot> | ||
<plot> | ||
<type>scatter</type> | ||
<x>outPP|Output|X (m)</x> | ||
<y>outPP|Output|Y (m)</y> | ||
<c>black</c> | ||
<marker>x</marker> | ||
</plot> | ||
<xlabel>x</xlabel> | ||
<ylabel>y</ylabel> | ||
</plotSettings> | ||
<actions> | ||
<how>png</how> | ||
</actions> | ||
</Plot> | ||
|
||
<Plot name="mySensorPlot3D"> | ||
<plotSettings> | ||
<plot> | ||
<type>scatter</type> | ||
<x>TwistDO|Output|X (m)</x> | ||
<y>TwistDO|Output|Y (m)</y> | ||
<z>TwistDO|Output|Temperature (K)</z> | ||
<cmap>coolwarm</cmap> | ||
<colorMap>TwistDO|Output|Temperature (K)</colorMap> | ||
</plot> | ||
<xlabel>x</xlabel> | ||
<ylabel>y</ylabel> | ||
<zlabel>temperature (K)</zlabel> | ||
</plotSettings> | ||
<actions> | ||
<how>png</how> | ||
</actions> | ||
</Plot> | ||
</OutStreams> | ||
|
||
</Simulation> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,12 @@ | |
required_libraries = 'imageio' | ||
rel_err = 0.01 | ||
[../] | ||
[./testSPSLOptiTwistClassification] | ||
type = 'RavenFramework' | ||
input = 'testSPSLOptiTwistClassification.xml' | ||
csv = 'classificationOptiTwist/outPP.csv' | ||
image = 'classificationOptiTwist/mySensorPlot_scatter-scatter.png classificationOptiTwist/mySensorPlot3D_scatter.png' | ||
required_libraries = 'imageio' | ||
rel_err = 0.01 | ||
[../] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will only review the image with a relative error of 0.01 which is too small for image comparison. We need to test the csv and the image. |
||
[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
cd
a typo?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Thank you for catching that. I have removed cd.