Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

alexhroom
Copy link
Collaborator

@alexhroom alexhroom commented Dec 10, 2024

This PR fixes #99. It additionally:

I've compared the results of the new DSPC_data_background and DSPC_function_background examples to those in the MATLAB and found that they give the same results between languages.


  • The source field has been added to the backgrounds and resolutions models. This fields contains the background parameter (for constant backgrounds), data entry (for data backgrounds), or custom file entry (for function backgrounds). The value fields (i.e., value_1 to value_5) are not required for constant backgrounds, value_1 contains an optional background_parameter used as a data offset, or contain up to five function arguments (all defined as background_parameters).
  • For resolutions, the function type is still not supported, constant works in the same way as for backgrounds, but for data, neither the source nor value fields are required.
  • When the background/resolution type is changed, the source and value fields should be cleared.
  • In the examples and jupyter notebooks, value_1 needs to be changed to source for constant type backgrounds and resolutions.
  • Use a python version of the data and function background examples to check everything works (probably worth adding them to the examples too).
  • The check_indices routine needs to be modified to reflect the change of contrastBackgroundParams to be a nested list, with a variable number of inputs, and to consider a custom file entry in the case of function backgrounds.
  • A routine mirroring insertDataBackgroundIntoContrastData is required, to populate the additional columns in the data files for data backgrounds.
  • The output result has had backgroundParams removed from the contrastParams sub struct, with backgrounds added to the main result struct. done in Updates C++ and some unit tests #97
  • ALL data files in the input problemStruct have been extended to EXACTLY six columns. Any empty columns are filled with zero values. done in Updates C++ and some unit tests #97
  • The problemStruct input contrastBackgroundParams has been modified to be a nested list. The nested lists may contain between one and five indices. These are the indices of the source field (from the appropriate data struct), and from the values fields: nothing else (for constant backgrounds), a potential offset (value_1 if non-empty, for data backgrounds), or up to five function arguments (for function backgrounds).
  • The field contrastBackgroundTypes has been added to problemStruct done in Updates C++ and some unit tests #97

@alexhroom alexhroom changed the title Update backgrounds and resolutions in line with the MATLAB Updates backgrounds and resolutions in line with the MATLAB Dec 10, 2024
Copy link
Collaborator

@DrPaulSharp DrPaulSharp left a comment

Choose a reason for hiding this comment

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

This is looking good so far. Alongside the comments, please add "backgrounds" to the output results dataclass (it's available in the C++), and then to the tests. As discussed, we should look to add the other updates to the inputs and outputs into the tests in another PR.

Copy link
Collaborator

@DrPaulSharp DrPaulSharp left a comment

Choose a reason for hiding this comment

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

This looks good, thanks for your hard work and patience on this. I've a few comments then we should be set.

In addition to those comments, I'm afraid set_fields has another hole in it, in that the type can be changed there, with an error triggered by the incorrect source. The easiest way to resolve this is to add a model validator to the project that gives an error for any change of type, but any better suggestions are gratefully received.

@alexhroom alexhroom requested a review from DrPaulSharp January 9, 2025 15:27
Copy link
Collaborator

@DrPaulSharp DrPaulSharp left a comment

Choose a reason for hiding this comment

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

This all looks great, thanks very much for all of your hard work and sticking with things as we were working through how to make everything work properly.

I've one last job for you, in line with the matlab, could you please include a warning in the Signal model that changing the type clears the fields.

@alexhroom alexhroom merged commit 92c6d67 into RascalSoftware:main Jan 10, 2025
7 checks passed
@alexhroom alexhroom deleted the 99-background-types branch January 10, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update backgrounds and resolutions in line with the MATLAB
2 participants