solver_interp Module
This module defines an interpolation based ODE solving-fitting routine. The ODE for the AT-TPC system is solved ahead of time for many different initial values. These solutions are then interpolated and fit to the data to determine a best set of parameters for a given trajectory. In this case the optimization used is L-BFGS-B.
distances(track, data, weights)
Calculate the average distance (error) of a track solution to the data
Loop over the data and approximate the error as the closest distance of a point in the track solution to the data. JIT-ed for speed
Parameters:
Name | Type | Description | Default |
---|---|---|---|
track |
ndarray
|
The track solution |
required |
data |
ndarray
|
The data to compare to |
required |
weights |
ndarray
|
The weights due to data uncertainty (1/sigma) |
required |
Returns:
Type | Description |
---|---|
float
|
The average distance (error) weighted by uncertainty |
Source code in src/spyral/solvers/solver_interp.py
fit_model_interp(cluster, guess, ejectile, interpolator, det_params, solver_params)
Used for jupyter notebooks examining the good-ness of the model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cluster |
Cluster
|
the data to be fit |
required |
guess |
Guess
|
the initial values of the parameters |
required |
ejectile |
NucleusData
|
the data for the particle being tracked |
required |
interpolator |
TrackInterpolator
|
the interpolation scheme to be used |
required |
det_params |
DetectorParameters
|
Configuration parameters for detector characteristics |
required |
solver_params |
SolverParameters
|
Configuration parameters for the solver |
required |
Returns:
Type | Description |
---|---|
Parameters | None
|
Returns the best fit Parameters upon success, or None upon failure |
Source code in src/spyral/solvers/solver_interp.py
interpolate_trajectory(fit_params, interpolator, ejectile)
Use the interpolation scheme to generate a trajectory from the given fit parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fit_params |
Parameters
|
the set of lmfit Parameters |
required |
interpolator |
TrackInterpolator
|
the interpolation scheme |
required |
ejectile |
NucleusData
|
data for the particle being tracked |
required |
Returns:
Type | Description |
---|---|
ndarray | None
|
Returns a array of interpolated ODE trajectory data. Upon failure (typically an out of bounds for the interpolation scheme) returns None. |
Source code in src/spyral/solvers/solver_interp.py
objective_function(fit_params, x, weights, interpolator, ejectile)
Function to be minimized. Returns errors for data compared to estimated track.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fit_params |
Parameters
|
the set of lmfit Parameters |
required |
x |
ndarray
|
the data to be fit (x,y,z) coordinates in meters |
required |
weights |
ndarray
|
The weights due to data uncertainty (1/sigma) |
required |
interpolator |
TrackInterpolator
|
the interpolation scheme to be used |
required |
ejectile |
NucleusData
|
the data for the particle being tracked |
required |
Returns:
Type | Description |
---|---|
float
|
the error between the estimate and the data |
Source code in src/spyral/solvers/solver_interp.py
solve_physics_interp(cluster_index, orig_run, orig_event, cluster, guess, ejectile, interpolator, det_params, solver_params)
High level function to be called from the application.
Takes the Cluster and fits a trajectory to it using the initial Guess. It then writes the results to the dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cluster_index |
int
|
Index of the cluster in the hdf5 scheme. Used only for debugging |
required |
orig_run |
int
|
The original run number |
required |
orig_event |
int
|
The original event number |
required |
cluster |
Cluster
|
the data to be fit |
required |
guess |
Guess
|
the initial values of the parameters |
required |
ejectile |
NucleusData
|
the data for the particle being tracked |
required |
interpolator |
TrackInterpolator
|
the interpolation scheme to be used |
required |
det_params |
DetectorParameters
|
Configuration parameters for detector characteristics |
required |
solver_params |
SolverParameters
|
Configuration parameters for the solver |
required |
Returns:
Type | Description |
---|---|
SolverResult | None
|
The best-fit result of the solver, or None if it failed |
Source code in src/spyral/solvers/solver_interp.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
|