webbpsf icon indicating copy to clipboard operation
webbpsf copied to clipboard

Phase decomposition updates

Open mperrin opened this issue 2 years ago • 3 comments

(Some code I wrote back in the crazy blur of this past spring, but never PRed at the time...)

  • Refactor SUR class to allow creating an empty SUR in Python, adding values, and then writing it out to disk. (Before this, the code was able to read in SURs but you couldn't just create one. While we don't expect or intend to create any SURs for flight usage this way, in some simulation cases this can be useful).
  • Update move_sur function to allow passing in a SUR object, as well as a filename on disk for a SUR file.
  • Add a function get_rms_per_segment which computes the RMS WFE per each segment.

mperrin avatar Oct 25 '22 00:10 mperrin

I have been using the RMS function already in OPDS to calculate the RMS per segment, this new function seems to be doing the same thing or is there something different? https://github.com/spacetelescope/webbpsf/blob/develop/webbpsf/opds.py#L545 I guess this one is easier to use just with the OPD array because for the other one I have to define an OPD object but it is the same. Just a comment, I think is good to have a similar function that's easier to use.

obi-wan76 avatar Oct 25 '22 13:10 obi-wan76

@obi-wan76 Yes I think this ought to yield consistent result with the one in OPDS... But checking, the two functions yield slightly different values. One is using the RMS but the other is using the std dev (These are only identical if the mean is zero, but slightly different if not). I'll fix this so they're consistent!

mperrin avatar Oct 27 '22 15:10 mperrin

Codecov Report

Base: 56.41% // Head: 56.60% // Increases project coverage by +0.19% :tada:

Coverage data is based on head (6f47502) compared to base (cc16c90). Patch coverage: 83.58% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #601      +/-   ##
===========================================
+ Coverage    56.41%   56.60%   +0.19%     
===========================================
  Files           13       13              
  Lines         5871     5911      +40     
===========================================
+ Hits          3312     3346      +34     
- Misses        2559     2565       +6     
Impacted Files Coverage Δ
webbpsf/opds.py 48.21% <76.47%> (+0.58%) :arrow_up:
webbpsf/surs.py 63.00% <86.00%> (+3.78%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 27 '22 15:10 codecov[bot]

@obi-wan76 would you be willing to review this please? Should be good to go now.

mperrin avatar Nov 07 '22 16:11 mperrin