Skip to content

Add a native Fortran .param file reader #132

Description

@neuromechanist

Background

Reviewer feedback on the JOSS paper (Arnaud Delorme) asked whether pyAMICA and the
reference Fortran binary can be driven from the same configuration file. Right now
the answer is: partially.

AMICA.from_params_file (pyAMICA/amica.py) reads a JSON file
(sample_data/sample_params.json), whose keys mostly reuse Fortran input.param
names (lrate, do_newton, rho0, block_size, max_iter, num_models, ...),
but:

  • not all keys match one-to-one -- e.g. num_mix (JSON) vs num_mix_comps
    (Fortran input.param)
  • pyAMICA has no reader for the literal Fortran .param text format at all, so a
    Fortran input.param file cannot currently be handed to pyAMICA directly

Proposal (revised: translator, not a second parser)

We already have a working JSON-parameter code path (from_params_file ->
constructor kwargs). Rather than teaching that path to also parse Fortran syntax,
add a small translator: parse the plain-text key value lines of a Fortran
input.param file into a dict, rename the handful of mismatched keys
(num_mix_comps -> num_mix, etc. -- full mapping TBD by diffing
sample_params.json against input.param), and hand the result to the exact same
construction path from_params_file already uses. No new parameter-handling logic,
just an input-format adapter in front of the existing one.

Document the key-mapping table alongside docs/guides/validation.md#parameter-files.

Why

So a single parameter file can drive both the Fortran binary and pyAMICA for a
parity run, instead of maintaining a hand-translated JSON copy.

Not required for the current JOSS submission; tracked here as anticipated follow-up
work per reviewer feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions