Skip to content
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

Open
wants to merge 57 commits into
base: devel
Choose a base branch
from

Conversation

niharika2999
Copy link
Collaborator

@niharika2999 niharika2999 commented Jul 29, 2024


Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

Closes #2347

What are the significant changes in functionality due to this change request?

For Change Control Board: Change Request Review

The following review must be completed by an authorized member of the Change Control Board.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass, including run_tests, pylint, manual building and xsd tests. If there are changes to Simulation.py or JobHandler.py the qsub tests must pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. If new development on the internal JobHandler parallel system is performed, a cluster test must be added setting, in XML block, the node <internalParallel> to True.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added is the the analytic documentation updated/added?
  • 9. If any test used as a basis for documentation examples (currently found in raven/tests/framework/user_guide and raven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.

@joshua-cogliati-inl
Copy link
Contributor

I believe this uses features in sparsesensing that are not yet in a released version, so besides any other work that needs to be done, this should not be merged until the sparsesensing release comes out.

@moosebuild
Copy link

Job Test mac on d2dc13b : invalidated by @joshua-cogliati-inl

failed in fetch

@joshua-cogliati-inl
Copy link
Contributor

Job Test mac on d2dc13b : invalidated by @joshua-cogliati-inl

failed in fetch

Opps, actually failed in set python environment.

Copy link
Contributor

@joshua-cogliati-inl joshua-cogliati-inl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some comments for your consideration.

<Output class="DataObjects" type="DataSet">outPP</Output>
</PostProcess>
<IOStep name="print">
<Input class="DataObjects" type="DataSet">outPP</Input>
<Input class="DataObjects" type="DataSet">outPP</Input>cd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cd a typo?

Copy link
Collaborator Author

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.

goal.addSub(xValue)
yValue = InputData.parameterInputFactory("yValue", contentType=InputTypes.StringListType,
printPriority=108,
descr=r"""Variable plotted on the Y-axis of the data model""") ##Do we want another Z-value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, do we want a zValue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! In case we have 3D data! Thank you for catching that!

printPriority=108,
descr=r"""X coordinate of the focus of the parabola""")
goal.addSub(a)
xy_coords = InputData.parameterInputFactory("xy_coords", contentType=InputTypes.IntegerListType, ##What is the type for an array?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, some of the comments like "What is the type for an array?" look like they may be out of date.

self.sampleTag = 'RAVEN_sample_ID' # The sample tag
self.center_x = None # The x co-ordinate of center of circle,ellipse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it looks like this only supports one Constrained Region? I think PySensors supports multiple constrained regions?

## TODO: Add GQR for constrained optimization
elif self.optimizer.lower() == 'gqr':
optimizer = ps.optimizers.GQR()
## TODO: Add CCQR for cost constrained optimization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do any of these TODO's need to be fixed?

@@ -0,0 +1,136 @@
<?xml version="1.0" ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not seem to be used in the tests yet.

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

<constraintOption>"exact_n"</constraintOption>
<ConstrainedRegions type = "circle">
<center_x></center_x> #center coordinates instead (x,y) (r, \theta)
<center_y></center_y>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments in xml are done using <!--your comment-->
center_x and center_y seems not to be recognized

image = 'classificationOptiTwist/mySensorPlot_scatter-scatter.png classificationOptiTwist/mySensorPlot3D_scatter.png'
required_libraries = 'imageio'
rel_err = 0.01
[../]
Copy link
Collaborator

Choose a reason for hiding this comment

The 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. rel_err for image can be 0.1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a gold file? (Also for the other outPP.csv files)

@@ -52,10 +54,26 @@ class cls.
printPriority=108,
descr=r"""Features/inputs of the data model""")
goal.addSub(features)
target = InputData.parameterInputFactory("target", contentType=InputTypes.StringType,
xValue = InputData.parameterInputFactory("xValue", contentType=InputTypes.StringListType,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that changing the input usually requires an automated script be created and placed in scripts/conversionScripts/

printPriority=108,
descr=r"""Variable plotted on the Y-axis of the data model""")
goal.addSub(yValue)
zValue = InputData.parameterInputFactory("yValue", contentType=InputTypes.StringListType,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this "zValue" = ... "yValue"?

idxConstrained, rank = parabola.get_constraint_indices(all_sensors = allSensors, info=dataframe)
elif self._ConstrainedRegionsType == 'Polygon':
xyTuple = [(self.xCoords[i], self.yCoords[i]) for i in range(0, len(self.xCoords))]
print(xyTuple)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print probably should be commented out, or switched to a self.raiseADebug

@moosebuild
Copy link

Job Test Ubuntu 18 PIP on c06a2bb : invalidated by @joshua-cogliati-inl

Cleaned up files on test machine.

@moosebuild
Copy link

Job Mingw Test on 254895a : invalidated by @niharika2999

1 similar comment
@moosebuild
Copy link

Job Mingw Test on 254895a : invalidated by @niharika2999

…straintsCircleOptiTwist/.DS_Store

Deleting unwanted files
…straintsCircleOptiTwist/mySensorPlot_scatter-scatter.png

Deleting unwanted files
…straintsCircleOptiTwist/mySensorPlot3D_scatter.png

Deleting unwanted files
…straintsCircleOptiTwist/outPP.csv

Deleting unwanted files
…straintsCircleOptiTwist/.ravenStatus

Deleting unwanted files
…straintsEllipseOptiTwist/.ravenStatus

Deleting unwanted files
…straintsEllipseOptiTwist/mySensorPlot3D_scatter.png

Deleting unwanted files
…straintsEllipseOptiTwist/mySensorPlot_scatter-scatter.png

Deleting unwanted files
…straintsEllipseOptiTwist/outPP.csv

Deleting unwanted files

<RunInfo>
<WorkingDir>reconstructionConstraintsOptiTwist</WorkingDir>
<Sequence>LoadCSV, mySPpp, print</Sequence>
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 reconstructionConstraintsOptiTwistCircle but in tests it is reconstructionOptiTwistConstraintsCircle. Hope this helps

Niharika Karnik and others added 8 commits September 17, 2024 10:03
…straintsCircleOptiTwist directory

Deleting wrongly named folders
…straintsEllipseOptiTwist directory

Deleting wrongly named folders
…straintsLineOptiTwist directory

Deleting wrongly named folders
…straintsParabolaOptiTwist directory

Deleting wrongly named folders
…straintsPolygonOptiTwist directory

Deleting wrongly named folders
@moosebuild
Copy link

Job Mingw Test on e3b6a09 : invalidated by @niharika2999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Adding constrained sparse sensing optimization
4 participants