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

Changes to the matlab code need to be reflected in the python #98

Open
DrPaulSharp opened this issue Dec 9, 2024 · 0 comments
Open
Labels

Comments

@DrPaulSharp
Copy link
Collaborator

DrPaulSharp commented Dec 9, 2024

The pull requests RascalSoftware/RAT#276, RascalSoftware/RAT#292, & RascalSoftware/RAT#294 (note that they were merged in this sequence) in the RAT repository make a number of changes to the submodule that need to be reflected in the python API, and covered by the test suite:

Backgrounds:
(all covered in #100)
data and function type backgrounds are now supported. The following changes have been made:

- 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.
- ALL data files in the input problemStruct have been extended to EXACTLY six columns. Any empty columns are filled with zero values.
- 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

Problem Cells:

The problemCells input to the compiled code has been removed, with most of its contents added to problemStruct. All trace of problemCells should be removed entirely (mostly done in #97, final trace removed in #100), alongside the following changes:

- The following fields have been added to problemStruct: data, dataLimits, simulationLimits, repeatLayers, contrastNames (now part of the nested names class - see below), contrastLayers, layersDetails, customFiles, domainContrastLayers. Refer to parseClassToStruct in the matlab for definitions. done in #97
- The names subclass has been added to problemStruct. This contains a list of names of all parameters defined in parameter-based models. These are: params, backgroundParams, scalefactors, qzshifts, bulkIns, bulkOuts, resolutionParams, domainRatios. Note that this order is hard-coded into RAT by the packParams and similar routines, so please preserve this order throughout the python API to emphasise its importance. done in #97

Problem Limits:

When re-evaluating the use of the problemLimits input, the following changes have been made:

- The checks class has been moved from controls to problemStruct. done in #97
- All parameter based fields (i.e., params, backgroundParams, scalefactors, qzshifts, bulkIns, bulkOuts, resolutionParams, domainRatios) are referred to as specified here i.e., in the plural, without any other words alongside, in: problemStruct, problemStruct.names, problemStruct.checks, problemLimits, priors
- problemStruct.contrastNames has been moved to problemStruct.names.contrasts. done in #97

The PR #97 updates the submodule, so there should not be any changes required to the C++ code. Refer also to #97 to see how the interface to the C++ code has changed.

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

No branches or pull requests

2 participants