pencil.tool_kit =============== .. py:module:: pencil.tool_kit .. autoapi-nested-parse:: Specialized tools that are of use to a limited number of users only. Submodules ---------- .. toctree:: :maxdepth: 1 /code/sourcePython/pencil/tool_kit/field_skeleton/index /code/sourcePython/pencil/tool_kit/write_forcing_cont/index Classes ------- .. autoapisummary:: pencil.tool_kit.NullPoint pencil.tool_kit.Separatrix pencil.tool_kit.Spine Functions --------- .. autoapisummary:: pencil.tool_kit.write_forcing_cont Package Contents ---------------- .. py:class:: NullPoint Bases: :py:obj:`object` Contains the position of the null points and the finding routine. Fill members with default values. .. py:attribute:: nulls :value: None .. py:attribute:: eigen_values :value: None .. py:attribute:: eigen_vectors :value: None .. py:attribute:: sign_trace :value: None .. py:attribute:: fan_vectors :value: None .. py:attribute:: normals :value: None .. py:method:: find_nullpoints(var, field) find_nullpoints(var, field) Find the null points to the field 'field' with information from 'var'. :param var: The var object from the read.var routine. :type var: obj :param field: The vector field name. :type field: string .. py:method:: write_vtk(datadir='data', file_name='nulls.vtk', binary=False) write_vtk(datadir='data', file_name='nulls.vtk', binary=False) Write the null point into a vtk file. :param datadir: Target data directory. :type datadir: string :param file_name: Target file name. :type file_name: string :param binary: Write file in binary or ASCII format. :type binary: bool .. py:method:: read_vtk(datadir='data', file_name='nulls.vtk') read_vtk(datadir='data', file_name='nulls.vtk') Read the null point from a vtk file. :param datadir: Origin data directory. :type datadir: string :param file_name: Origin file name. :type file_name: string .. py:class:: Separatrix Bases: :py:obj:`object` Contains the separatrix layers and methods to find them. Fill members with default values. .. py:attribute:: lines :value: [] .. py:attribute:: eigen_values :value: [] .. py:attribute:: eigen_vectors :value: [] .. py:attribute:: sign_trace :value: [] .. py:attribute:: fan_vectors :value: [] .. py:attribute:: normals :value: [] .. py:attribute:: separatrices :value: [] .. py:attribute:: connectivity :value: [] .. py:method:: find_separatrices(var, field, null_point, delta=0.1, iter_max=100, ring_density=8) find_separatrices(var, field, null_point, delta=0.1, iter_max=100, ring_density=8) Find the separatrices to the field 'field' with information from 'var'. :param var: The var object from the read_var routine. :type var: obj :param field: The vector field. :type field: string :param null_point: NullPoint object containing the magnetic null points. :type null_point: obj :param delta: Step length for the field line tracing. :type delta: float :param iter_max: Maximum iteration steps for the fiel line tracing. :type iter_max: int :param ring_density: Density of the tracer rings. :type ring_density: float .. py:method:: write_vtk(datadir='data', file_name='separatrices.vtk', binary=False) write_vtk(datadir='data', file_name='separatrices.vtk', binary=False) Write the separatrices into a vtk file. :param datadir: Target data directory. :type datadir: string :param file_name: Target file name. :type file_name: string :param binary: Write file in binary or ASCII format. :type binary: bool .. py:method:: read_vtk(datadir='data', file_name='separatrices.vtk') read_vtk(datadir='data', file_name='separatrices.vtk') Read the separatrices from a vtk file. :param datadir: Origin data directory. :type datadir: string :param file_name: Origin file name. :type file_name: string .. py:class:: Spine Bases: :py:obj:`object` Contains the spines of the null points and their finding routines. Fill members with default values. .. py:attribute:: spines :value: [] .. py:method:: find_spines(var, field, null_point, delta=0.1, iter_max=100) find_spines(var, field, null_point, delta=0.1, iter_max=100) Find the spines to the field 'field' with information from 'var'. :param var: The var object from the read_var routine. :type var: obj :param field: The vector field. :type field: string :param null_point: NullPoint object containing the magnetic null points. :type null_point: obj :param delta: Step length for the field line tracing. :type delta: float :param iter_max: Maximum iteration steps for the fiel line tracing. :type iter_max: int .. py:method:: write_vtk(datadir='data', file_name='spines.vtk', binary=False) write_vtk(datadir='data', file_name='spines.vtk', binary=False) Write the spines into a vtk file. :param datadir: Target data directory. :type datadir: string :param file_name: Target file name. :type file_name: string :param binary: Write file in binary or ASCII format. :type binary: bool .. py:method:: read_vtk(datadir='data', file_name='spines.vtk') read_vtk(datadir='data', file_name='spines.vtk') Read the spines from a vtk file. :param datadir: Target data directory. :type datadir: string :param file_name: Target file name. :type file_name: string .. py:function:: write_forcing_cont(a, outfile='forcing_cont.dat') Writes the file forcing_cont.dat that can be used to specify the form of the continuous forcing in forcing.f90 :param a: :type a: numpy array specifying the continuous forcing. Shape is expected to be (3,nz,ny,nx). Note that the order of the spatial indices is the same as in the rest of the Pencil Python module. :param outfile: :type outfile: file into which the array should be written :param Example usage: :param -------------: :param >>> import pencil as pc: :param >>> import numpy as np: :param >>> dim = pc.read.dim(): :param >>> a = np.ones((3: :param dim.nx: :param dim.ny: :param dim.nz)): :param >>> pc.tool_kit.write_forcing_cont(a):