line_tracing¶
- exception INGRID.line_tracing.RegionEntered(message, region)¶
Bases:
Exception
- class INGRID.line_tracing.LineTracing(grid, settings, eps=1e-06, tol=5e-05, first_step=1e-05, numPoints=25, dt=0.01, option='xpt_circ', direction='cw')¶
Bases:
object
This class traces the polodal and radial lines of a given psi function based of the points where the user clicks.
- Parameters
grid (EfitData.EfitData) – The grid object upon which the lines will be drawn.
settings (dict) – YAML file containing all INGRID parameters.
eps (float, optional) – Short for epsilon. Specifies the size of the circle drawn around the zero point.
tol (float, optional) – Short for tolerance. Specifies how close to the final point the line must get before converging. Also defines a circle.
numPoints (int) – Number of points in the circle of radius eps.
dt (float, optional) – Specify the size of each line segment that is traced by scipy.integrate.solve_ivp.
option (str, optional) – ‘theta’ draws the poloidal line where the user clicks. ‘rho’ draws the radial line where the user clicked. ‘xpt_circ’: uses the root finder to find the root closest to where the user clicked. Then finds the points around that circle a distance epsilon away.
direction (str, optional) – ‘cw’ or ‘ccw’. Specifies clockwise or counterclockwise line tracing.
- DNL_find_NSEW(xpt1, xpt2, magx, visual=False)¶
Find NSEW based off primary x-point and magnetic axis,
- Parameters
xpt (array-like) – R, Z coordinate of the primary x-point.
mag (array-like) – R, Z coordinate of the magnetic axis.
Notes
LineTracer_psi will contain NSEW information post call.
- PsiCostFunc(xy)¶
- SNL_find_NSEW(xpt, magx, visual=False)¶
Find NSEW based off primary x-point and magnetic axis,
- Parameters
xpt (array-like) – R, Z coordinate of the primary x-point.
mag (array-like) – R, Z coordinate of the magnetic axis.
Notes
self.LineTracer_psi will contain NSEW information post call.
- analyze_saddle(xpt, xpt_ID)¶
Finds theta values to be tested for N and S directions
- disconnect()¶
Turns off the click functionality
- draw_line(rz_start, rz_end=None, color='purple', option=None, direction=None, show_plot=False, text=False, dynamic_step=None, debug=False, Verbose=False)¶
Uses scipy.integrate.solve_ivp to trace poloidal or radial lines. Uses the LSODA method to solve the differential equations. Three options for termination criteria, specified by rz_end.
- Parameters
rz_start (array-like or geometry.Point) – Starting location for line tracing.
rz_end (dict, optional) – Defaults to be rz_start. This is how we specify the termination critera. i.e. {‘point’: Point}, {‘line’: Line}, {‘psi’: Psi} Points can be a geometry.Point, or array-like i.e. (x, y) Lines can be a geometry.Line, or array-like i.e. ((x, y), (x, y)) Psi must be a scalar, i.e. 1.1, and specifies the level of psi to stop on.
color (str, optional) – Specifies the color of the produced grid lines.
option (str, optional) – Change which differential equation is used in the line tracing proccess. ‘theta’, ‘rho’
direction (str) – determines if the function plots clockwise (cw) or counterclockwise (ccw). default is None.
show_plot (bool, optional) – Show the user real-time tracing and the line tracer works.
text (bool, optional) – Prints convergence method, number of iterations, and time taken to the terminal window.
- Returns
line (geometry.Line) – Curved line consisting of the start and end points of each segment calculated by solve_ivp. Does not store the intermediate points.
- flip_NSEW_lookup(xpt_ID)¶
- map_xpt(xpt, magx, xpt_ID='xpt1', visual=False, verbose=False)¶
- rotate_NSEW_lookup(xpt_ID, turns=2)¶