mpacts.commands.onarrays. rescale

In order to be able to use this module import it like this:

import mpacts.commands.onarrays.rescale
#or assign it to a shorter name
import mpacts.commands.onarrays.rescale as res

RescaleArrayCommand

class mpacts.commands.onarrays.rescale.RescaleArrayCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Rescale given array with a scalar value.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array — Array that will be rescaled
    • scale — Scalar value with which the given array will be multiplied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decided whether or not the command is executed for a specific particle index (if omitted, the command is executed for all particle indices)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array, scale, [gate, predicate]
RescaleArrayCommand(name, parent, **kwargs)

RescaleBoundedCommand

class mpacts.commands.onarrays.rescale.RescaleBoundedCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Rescale a scalar array to withing given bounds shifting its mean to a given value.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array — Scalar array to re-scale
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • max (default value = 1.7976931348623157e+308) — Maximum of rescaled array, cannot be 0.
    • mean (default value = 1.7976931348623157e+308) — The rescaled mean is set to this.
    • min (default value = -1.7976931348623157e+308) — Minimum of rescaled array, cannot be 0.
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
    • scale_only_when_necessary (default value = 0) — If array between given bounds, do nothing.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, array, [gate, predicate, min, max, mean, scale_only_when_necessary]
RescaleBoundedCommand(name, parent, **kwargs)