-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update iteratefdtd_matrix
: dz/2
offset and system test input/output update
#253
Conversation
55236ab
to
bfa1657
Compare
iteratefdtd_matrix
: CIL options moved to input fileiteratefdtd_matrix
: dz/2
offset and system test input/output update
422efc1
to
e5a23ae
Compare
- optimise_J_loop_variables gains additional checks against accessing nullptrs - test_regen.py flushes correctly (so we know if regen has failed prior to the 1st test starting) - objects_from_infile destructor only deallocates if there is memory to deallocate - Source methods changed to const
- Config files for 01-13, example_fdtd updated - test_regen temporarily ignores arc_17,18 - matfile_option_edit.py is created, allowing us to edit single-value variables in existing .mat files - iteratefdtd_matrix updated to at least save usecd variable, even though it is still not used by tdms
Updates have been made to arc_01 to be in-line with the dz/2 bug fix: - efield functions no longer multiply field by 2 and offset by dz/2 - new iteratefdtd_matrix is added to overwrite the old one (although we should go back and reconcile this with the MATLAB tests we currently employ) HOWEVER: - It looks like some of the dz/2 hardcoded values did not match the delta.z values that come in from the input file. arc_01 can demo this: delta.z = lambda/4, but it was using dz = lambda/6 in e_field_gauss! As such, the test now "fails" because the input file generated is different, ergo the output is different from the reference. You can even notice that, if you change iteratefdtd_matrix to have delta.z/2*4/6, the arc_01 tests will all pass again!!
- InvalidIlluminationSourceExiEyiErrors test case is now covered by the source-input combinations test cases - IlluminationAndEfield is no longer needed - this case is now permitted as per Peter's request
- Explicit cast of efname and hfname to strings to avoid warnings - Pull out some common functionality - Refactors and adds docstrings to MATLAB functions Squashed commit of the following: commit 26308703039ecfe7e4ea18d022278be0783ad66e Author: willGraham01 <1willgraham@gmail.com> Date: Mon Apr 3 10:44:09 2023 +0100 Complete iteratefdtd_matrix refactor commit 96580be13e8a3712a6ed01d58808fddaf06db523 Author: willGraham01 <1willgraham@gmail.com> Date: Fri Mar 31 16:16:05 2023 +0100 refactor and tidy iteratefdtd_matrix... but something has broken commit 78134e7a630bfb1a53be39176da62f21b68d73ae Author: willGraham01 <1willgraham@gmail.com> Date: Fri Mar 31 16:15:46 2023 +0100 refactor and tidy iteratefdtd_matrix... but something has broken commit d3cad0cd7ff9710ba63f1b1749a9856398def8de Author: willGraham01 <1willgraham@gmail.com> Date: Fri Mar 31 15:09:56 2023 +0100 Update input file syntax to avoid MATLAB warnings commit d3e1b8f9bf9a37d34381385f5228386a84a48e57 Author: willGraham01 <1willgraham@gmail.com> Date: Fri Mar 31 13:59:02 2023 +0100 Give .m function and file same name commit fac50f86013978b25b17152c61bcaad141043e30 Author: willGraham01 <1willgraham@gmail.com> Date: Fri Mar 31 13:55:49 2023 +0100 Update docstrings and function syntax in MATLAB unit tests commit 25f0a497cacfdeb301a7be1c454636b3ba4a4e90 Author: willGraham01 <1willgraham@gmail.com> Date: Fri Mar 31 12:11:28 2023 +0100 Remove copy of pstd_input_file_2D and redirect tests appropriately commit 22bd7ea5d9ba0f11d3a8209e26458bac4020c1b5 Author: willGraham01 <1willgraham@gmail.com> Date: Fri Mar 31 12:10:11 2023 +0100 DRY test_iteratefdtd_matrix.m
- edit_mat_file function replaces wrapping class
3c22e76
to
2a9b38f
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #253 +/- ##
==========================================
+ Coverage 48.09% 48.15% +0.06%
==========================================
Files 63 63
Lines 7804 7808 +4
==========================================
+ Hits 3753 3760 +7
+ Misses 4051 4048 -3
☔ View full report in Codecov by Sentry. |
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.
Some of my suggestions are potentially a bit fiddly and I might have broken your words/code 😵💫 .
@pytest.mark.filterwarnings( | ||
"ignore::DeprecationWarning" | ||
) # hdf5storage.savemat throws a comparison warning from within numpy |
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.
Ah, right. The (much much) lesser of the evils.
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.
Yeah :/ Although I can make a ticket to use h5py
rather than hdf5storage
to do the "adjusting".
Now we know that only -v7.3
.mat
files are HDF5
(and we're enforcing saving in this convention), we can in theory have the "adjust" method read/write via h5py
assuming there's no funny business with MATLAB
-> Python
datatypes.
Super weird though: is that sometimes the failure causes the @CodeCovBot's check to fail permanently, and sometimes it's smart enough to notice that the coverage has updated to be more consistent and also update the check to a pass. All of this would be a moot point if I just figured out #279. |
Co-authored-by: Sam Cunliffe <samcunliffe@users.noreply.github.com>
Closes #240, #259, #260 | Moves towards #208 and #217
Also closes #169
Sorry about the large diff, but a lot of it is just config file updates and the like. The features this touches are all interlinked, so we can't solve one without upsetting the others.
Features
optimise_J_loop
bugsKsource
is non-empty before trying to access dataSource
can be accessed via the[]
operator, returning the complex value thatSource.real[k][j][i] + i * Source.imag[k][j][i]
representsSource
also has avalue_or_zero_if_empty
method, which accounts for the new functionality where the Source arrays are permitted to be empty and implicitly zero.nz_ksource
(the array used in optimising the loop variables) has undergone a cleanup in how its elements are assigned.mat
inputs during the regeneration process.mat
inputs that contain identical data but different "flag" variables (that replace the CLI flags) can be produced without re-running therun_bscan
script. Instead,Python
can usematload
andmatsave
to toggle these valuesconfig_XX.yaml
files adjusted to the new "adjust" syntax.tdms/tests/system/README.md
updated accordinglyiteratefdtd_matrix.m
#260.iteratefdtd_matrix
behaviour as per arc_19arc_19
provided in Update toiteratefdtd_matrix
#208 details the compatible inputs toiteratefdtd_matrix
. The various cases are now checked for expected errors intest_iteratefdtd_matrix_source_combinations.m
.arc_19
has no system test runs, IE no calls totdms
for reference inputs/outputs.iteratefdtd_matrix
function.eval
statements and replaces them with explicit function-handle casts.Updating the reference outputs
The reference inputs and outputs will need to be replaced on Zenodo pending this update, since the input
.mat
files have changed. There's a brief log of the differences induced in the output files here:input_file_changes.log
The major changes are largely reconciling hardcoded values of
dz
, which means the numerical data in the.mat
input files is now different, and the reference outputs correspondingly updated. Addingcompactsource
to all the input files, and some illumination setup options, are the other changes.When this is approved, the GitHub cache will need to be cleared, the new data files uploaded to Zenodo, and the
test_system.py
andtest_regen.py
links updated to point to the new data. This should force GitHub to re-download the new input data and references.