I have a Mathematica module im_solver.m that I wish to iterate through Python or a bash script. The module runs a bunch o' other modules. At the end im_solver.m executes a diagnostic.m that collects all the data and exports to an existing file match_data.csv.
When I run << im_solver.m in a Mathematica notebook everything behaves as expected. When I try and execute im_solver.m through the command line–either through Python or just the regular ol' terminal–the csv is populated with a bunch of nonsense. I'm not sure where the difference comes from. The Mathematica modules are pretty intense and I think at best I can make minimal alterations. I included an example below. Please help =)
Example (Good) Here is a sample of the good output
| Lq (mm) | KE (keV) |
|---|---|
| 0.695 | 7. |
Example (Messed Up)
| Lq (mm) | KE (keV) |
|---|---|
| 1.A~\227 10 Max[0. | -2.5858 A~\227 10 gradscale |
One note: when opening the CSV file I'm hit with a warning that I have 1258 columns, this is the number of sample points in an array that I use to perform some numerical procedures. So it would appear that this array is being saved to the CSV for whatever reason. As I said, this does not happen when running the module through a notebook. Additionally, in the second column there is "gradscale" which is a variable used to scale the gradient array of size 1258.
For reference:
- Mathematica Version 13.2
- WolframScript 1.9.0 for Mac OS X x86 (64-bit)
- MacOS Ventura 13.3.1
UsingFrontEndwrap all or part of your code. $\endgroup$