generate_eq_sols
¶
Functions:
-
eq_sol–Get the solution of the equilibrium equations for given parameters.
-
generate_equilibrium_solutions–Generate equilibrium solution objects for a set of parameters and save them to files.
-
main–Command-line interface for generating and saving equilibrium solutions.
eq_sol
¶
Get the solution of the equilibrium equations for given parameters.
Parameters:
-
(alpha¶float) –Alpha parameter.
-
(theta_0¶float) –Theta_0 parameter.
-
(delta_h¶float) –Delta_h parameter.
Returns:
-
sol(OdeSolution) –Solution object of the second equilibrium ODE system.
-
delta_a(float) –Computed value of the
delta_aparameter obtained from the first equilibrium solution. -
rfp_flag(bool) –Flag indicating whether the resulting configuration is in the RFP (reversed field pinch) regime according to :func:
eqs.eq2_sol.
Source code in src/fpga_profile_reco/data/generate_eq_sols.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
generate_equilibrium_solutions
¶
generate_equilibrium_solutions(n_samples: int, grid: bool, alpha_samples: int, theta_0_samples: int, delta_h_samples: int, seed: int, save_path: Path, n_jobs: int = 1)
Generate equilibrium solution objects for a set of parameters and save them to files.
Depending on the value of grid, this function either generates a regular
grid over the parameter space or draws random samples uniformly within the
parameter bounds defined in :mod:fpga_profile_reco.data.equations. For each
parameter combination, the corresponding equilibrium ODE solutions are
computed and serialized in batched pickle files under save_path.
Parameters:
-
(n_samples¶int) –Total number of random samples to generate (only used if
gridis False). -
(grid¶bool) –If True, generate a Cartesian grid of parameters using
alpha_samples,theta_0_samplesanddelta_h_samples. Otherwise, sample parameters randomly. -
(alpha_samples¶int) –Number of samples for the
alphaparameter whengridis True. -
(theta_0_samples¶int) –Number of samples for the
theta_0parameter whengridis True. -
(delta_h_samples¶int) –Number of samples for the
delta_hparameter whengridis True. -
(seed¶int) –Random seed for reproducibility (only used if
gridis False). -
(save_path¶Path) –Directory where the generated solution batches (pickle files) are saved. The directory is created if it does not exist.
-
(n_jobs¶int, default:1) –Number of parallel worker processes used to compute the solutions. Defaults to 1.
Returns:
-
None–The function is executed for its side effects of computing and saving solution batches to disk.
Source code in src/fpga_profile_reco/data/generate_eq_sols.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
main
¶
main()
Command-line interface for generating and saving equilibrium solutions.
This function parses command-line arguments and forwards them to
:func:generate_equilibrium_solutions. It supports both grid-based and
random sampling of parameters and controls the output directory and
parallelism.
Command Line Parameters
--n_samples: int, optional Total number of random samples to generate (only used if--gridis not set). Default is 100000.--grid: flag, optional If provided, generate a Cartesian grid of parameters instead of random samples.--alpha_samples: int, optional Number of samples for thealphaparameter when--gridis set. Default is 101.--theta_0_samples: int, optional Number of samples for thetheta_0parameter when--gridis set. Default is 101.--delta_h_samples: int, optional Number of samples for thedelta_hparameter when--gridis set. Default is 11.--seed: int, optional Random seed for reproducibility when--gridis not set. Default is 42.--save_path: pathlib.Path Path to the output directory where solution batches will be stored. This argument is required.--n_jobs: int, optional Number of parallel worker processes. Default is 1.
Source code in src/fpga_profile_reco/data/generate_eq_sols.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |