Skip to content

Refactor parameter setup to return structured configs#2

Open
yexf308 wants to merge 3 commits into
mainfrom
codex/refactor-set_parameter-function-to-return-struct
Open

Refactor parameter setup to return structured configs#2
yexf308 wants to merge 3 commits into
mainfrom
codex/refactor-set_parameter-function-to-return-struct

Conversation

@yexf308
Copy link
Copy Markdown
Owner

@yexf308 yexf308 commented Nov 6, 2025

Summary

  • convert each model's set_parameter script into a function that returns a structured params configuration
  • update learning, simulation, and MFPT workflows to consume the params struct instead of relying on implicit workspace variables
  • document the params object layout in the README for easier discovery

Testing

  • not run (Matlab scripts)

https://chatgpt.com/codex/tasks/task_e_690be8f3f0ac83309955c18966ecda5b

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Halfmoon.m
Comment on lines 17 to +20
%% Set up the parameter
rng(k)
set_parameter;
disp('Parameter is set')

chart_fileName = [datapath,'chart',num2str(k),'.mat'];
chart_part_fileName = [datapath,'chart_part',num2str(k),'.mat'];
TranM_fileName = [datapath,'TranM',num2str(k),'.mat'];
diary_fileName = [datapath,'diary',num2str(k),'.txt'];
rng(k)
params = set_parameter;
disp('Parameter is set')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Invoke set_parameter instead of capturing function handle

The Halfmoon driver assigns params = set_parameter; even though set_parameter now returns the configuration struct. In MATLAB omitting the parentheses yields a function handle, so the next line params.paths.chart = … will throw because function handles do not have fields. Call set_parameter() (the same applies to the later call in the x==2 branch) so that params holds the struct.

Useful? React with 👍 / 👎.

Comment thread Peanut.m
Comment on lines 19 to +22
%% Set up the parameter

rng(k)
set_parameter;
disp('Parameter is set')
rng(k)
params = set_parameter;
disp('Parameter is set')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Call set_parameter() when initialising Peanut params

set_parameter was converted into a function that returns the parameter struct, but the Peanut driver still does params = set_parameter; in both execution branches. This leaves params as a function handle, so any subsequent property access (e.g. params.paths.chart) will fail at runtime. The call should use set_parameter() to obtain the struct before updating fields.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant