Skip to content

Patch for maxpolydeg parameter#171

Open
ChengranAA wants to merge 1 commit intocvnlab:mainfrom
ChengranAA:main
Open

Patch for maxpolydeg parameter#171
ChengranAA wants to merge 1 commit intocvnlab:mainfrom
ChengranAA:main

Conversation

@ChengranAA
Copy link
Contributor

@ChengranAA ChengranAA commented Feb 7, 2025

Patch for maxpolydeg paramater

Apologies for breaking the code. I intended to follow the comments regarding maxpolydeg, but I didn’t realize that there was no expansion for the range array in the following code.

To address this issue, I propose a patch that adds an additional check at the bottom to verify if the array is a list. This implementation allows users to create an array with varying degrees for each run.

if 'maxpolydeg' not in params:
	params['maxpolydeg'] = [
                    alt_round(
                        ((self.data[r].shape[-1]*tr)/60)/2)
                    for r in np.arange(numruns)]
  
# ......

if type(params['maxpolydeg']) is int:
	params['maxpolydeg'] = np.tile(
                params['maxpolydeg'], numruns
            ).tolist()
if type(params['maxpolydeg']) is list:
 	params['maxpolydeg'] = [np.arange(d + 1) for d in params['maxpolydeg']]

For example if input is an integer:

params['maxpolydeg'] = 8
numruns = 5

Then the constructed maxpolydeg will be

[array([0, 1, 2, 3, 4, 5, 6, 7, 8]),
 array([0, 1, 2, 3, 4, 5, 6, 7, 8]),
 array([0, 1, 2, 3, 4, 5, 6, 7, 8]),
 array([0, 1, 2, 3, 4, 5, 6, 7, 8]),
 array([0, 1, 2, 3, 4, 5, 6, 7, 8])]

If input is an array of degrees:

params['maxpolydeg'] = [5, 6, 7, 8, 9]

Then the constructed maxpolydeg will be

[array([0, 1, 2, 3, 4, 5]),
 array([0, 1, 2, 3, 4, 5, 6]),
 array([0, 1, 2, 3, 4, 5, 6, 7]),
 array([0, 1, 2, 3, 4, 5, 6, 7, 8]),
 array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])]

If no input is provided, the code will first construct a maximum degree for each run and then generate the maxpolydegrange arrays accordingly.

A review is still needed, but I believe this patch not only addresses the previous issue but also improves functionality by enabling users to input varying maximum polynomial degrees for each run.

Once again, I apologize for any inconvenience I may have caused.

Best.

@jacob-prince jacob-prince self-assigned this Feb 9, 2025
@jacob-prince
Copy link
Collaborator

Thank you for proposing this fix - we are reviewing.

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.

2 participants