Migrating to 2.0 ================ pyRat_ 2.0 changes a few things that scripts written for 1.x rely on. The full list is in pyRat_'s ``CHANGELOG.md``. Logging ------- ``pyrat.log`` is now the standard ``logging`` module, kept minimal (see :doc:`../module`): - ``pyrat.log.config()`` is gone: ``pyrat.log.enable(level)`` shows pyRat_'s messages, ``pyrat.log.get(name)`` gives a script its own logger. - The ``HINT`` and ``RESULT`` levels, the colour formatter and the ``logs/`` file are gone. - ``import pyrat`` no longer configures logging. .. code-block:: python # pyRat 1.x plg = pyrat.log.config(__file__) # pyRat 2.0 plg = pyrat.log.get("my_script") pyrat.log.enable() Vector-shaped fields are flat lists ----------------------------------- Fields shaped as vectors (1 x N or N x 1) come back as flat lists. A frame with several sections used to give ``[[R0, R1, ...]]`` but ``[R0]`` with one section; ``frame.get_coords()`` is now always ``[R0, R1, ...]``. Code that unwrapped the outer list drops that step. Fields with both dimensions above 1, and 3D fields, keep their nesting. ``CrossPoint`` is a round wire ------------------------------ ``CrossPoint(nc, tc, radius)`` replaces ``CrossPoint(nc, tc, thickness, width)``, and the ``radius`` property replaces ``thickness`` and ``width``. To keep the same conductor area, current density and field: .. code-block:: python # pyRat 1.x cross = rat.mdl.CrossPoint(nc, tc, t, w) # pyRat 2.0 cross = rat.mdl.CrossPoint(nc, tc, rat.mdl.CrossPoint.radius_from_area(t * w)) Coil source settings -------------------- These follow the Rat-Models_ libraries pyRat_ 2.0 builds against: - ``SourceType.AUTO`` takes fixed source settings: a coil's ``line_source_points``, ``softness``, ``wire_core``, ``centerline_radius`` and ``soleno_num_layers`` no longer reach an ``AUTO`` coil. Code that raised them on an ``AUTO`` coil for finer sources selects an explicit type, e.g. ``SourceType.LINE_CURRENTS``. - ``num_gauss`` is the integration order only: the line currents of a coil take ``line_source_points``. A script that set ``num_gauss`` to refine its sources sets ``line_source_points`` too (a saved model converts on load). - ``softness`` replaces ``softening`` as the soft core radius factor, without its extra ``sqrt(2)``. ``softening`` stays, with its former meaning, so existing scripts keep theirs. Smaller changes --------------- - Errors raised by RAT are ``pyrat.rat.RatError`` (a ``RuntimeError``), Armadillo errors ``ValueError`` or ``IndexError``; reading a write-only property raises ``AttributeError``. - Matrices come back Fortran-ordered (column-major, as in Armadillo), which only shows in ``.flags`` and ``.strides``. - ``calculate()`` defaults ``time`` to ``0.0``. - ``Mlfmm.create(targets, sources)``: the keyword names now match their arguments (``src`` used to name the targets); check calls that pass them by keyword.