Skip to content

Mixed Mode

This sublmodule contains the Mixed Mode method and Stage classes.

See this link for an example how to set it up.

pypalmsens.mixed_mode.MixedMode


              flowchart TD
              pypalmsens.mixed_mode.MixedMode[MixedMode]
              pypalmsens._methods.base.BaseTechnique[BaseTechnique]
              pypalmsens._methods.mixins.CurrentRangeMixin[CurrentRangeMixin]
              pypalmsens._methods.mixins.PretreatmentMixin[PretreatmentMixin]
              pypalmsens._methods.mixins.PostMeasurementMixin[PostMeasurementMixin]
              pypalmsens._methods.mixins.DataProcessingMixin[DataProcessingMixin]
              pypalmsens._methods.mixins.GeneralMixin[GeneralMixin]
              pypalmsens._methods.base_model.BaseModel[BaseModel]

                              pypalmsens._methods.base.BaseTechnique --> pypalmsens.mixed_mode.MixedMode
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.base.BaseTechnique
                

                pypalmsens._methods.mixins.CurrentRangeMixin --> pypalmsens.mixed_mode.MixedMode
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.CurrentRangeMixin
                

                pypalmsens._methods.mixins.PretreatmentMixin --> pypalmsens.mixed_mode.MixedMode
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.PretreatmentMixin
                

                pypalmsens._methods.mixins.PostMeasurementMixin --> pypalmsens.mixed_mode.MixedMode
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.PostMeasurementMixin
                

                pypalmsens._methods.mixins.DataProcessingMixin --> pypalmsens.mixed_mode.MixedMode
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.DataProcessingMixin
                

                pypalmsens._methods.mixins.GeneralMixin --> pypalmsens.mixed_mode.MixedMode
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.GeneralMixin
                



              click pypalmsens.mixed_mode.MixedMode href "" "pypalmsens.mixed_mode.MixedMode"
              click pypalmsens._methods.base.BaseTechnique href "" "pypalmsens._methods.base.BaseTechnique"
              click pypalmsens._methods.mixins.CurrentRangeMixin href "" "pypalmsens._methods.mixins.CurrentRangeMixin"
              click pypalmsens._methods.mixins.PretreatmentMixin href "" "pypalmsens._methods.mixins.PretreatmentMixin"
              click pypalmsens._methods.mixins.PostMeasurementMixin href "" "pypalmsens._methods.mixins.PostMeasurementMixin"
              click pypalmsens._methods.mixins.DataProcessingMixin href "" "pypalmsens._methods.mixins.DataProcessingMixin"
              click pypalmsens._methods.mixins.GeneralMixin href "" "pypalmsens._methods.mixins.GeneralMixin"
              click pypalmsens._methods.base_model.BaseModel href "" "pypalmsens._methods.base_model.BaseModel"
            

Create mixed mode method parameters.

Mixed mode is a flexible technique that allows for switching between potentiostatic, galvanostatic, and open circuit measurements during a single run.

The mixed mode uses different stages similar to the levels during Multistep Amperometry or Potentiometry, but each stage can be galvanostatic or potentiostatic independent of the previous stage.

The available stage types are ConstantE, ConstantI, SweepE, OpenCircuit and Impedance.

  • ConstantE: Apply constant potential
  • ConstantI: Apply constant current
  • SweepE: potential linear sweep (ramp) similar to a regular LSV step
  • OpenCircuit: Measure the OCP value
  • Impedance: the impedance is measured by applying a small AC potential superimposed with a DC potential. This corresponds to an EIS single frequency step (scan_type = 'fixed', freq_type = 'fixed')

Each stage can use the previous stage’s potential as a reference point, for example, a constant current is applied for a fixed period and afterward, the reached potential is kept constant for a fixed period.

Furthermore, each stage can end because a fixed period has elapsed, or certain criteria are met. Available criteria include reaching a maximum current, minimum current, maximum potential, and minimum potential.

Methods:

  • from_dict

    Structure technique instance from dict.

  • from_method_id

    Create new instance of appropriate technique from method ID.

  • to_dict

    Return the technique instance as a new key/value dictionary mapping.

Attributes:

current_range class-attribute instance-attribute

current_range: CurrentRange = Field(default_factory=CurrentRange)

Set the autoranging current.

cycles class-attribute instance-attribute

cycles: int = 1

Number of times to go through all stages.

data_processing class-attribute instance-attribute

data_processing: DataProcessing = Field(default_factory=DataProcessing)

Set the data processing settings.

general class-attribute instance-attribute

general: General = Field(default_factory=General)

Sets general/other settings.

interval_time class-attribute instance-attribute

interval_time: float = 0.1

Time between two samples in s.

post_measurement class-attribute instance-attribute

post_measurement: PostMeasurement = Field(default_factory=PostMeasurement)

Set the post measurement settings.

pretreatment class-attribute instance-attribute

pretreatment: Pretreatment = Field(default_factory=Pretreatment)

Set the pretreatment settings.

stages class-attribute instance-attribute

stages: list[StageType] = Field(default_factory=list)

List of stages to run through.

use_triggers property

use_triggers

True if any of the stages has triggers set.

from_dict classmethod

from_dict(obj: dict[str, Any]) -> BaseTechnique

Structure technique instance from dict.

Opposite of .to_dict()

Source code in src/pypalmsens/_methods/base.py
35
36
37
38
39
40
@classmethod
def from_dict(cls, obj: dict[str, Any]) -> BaseTechnique:
    """Structure technique instance from dict.

    Opposite of `.to_dict()`"""
    return cls.model_validate(obj)

from_method_id classmethod

from_method_id(id: str) -> BaseTechnique

Create new instance of appropriate technique from method ID.

Source code in src/pypalmsens/_methods/base.py
42
43
44
45
46
@classmethod
def from_method_id(cls, id: str) -> BaseTechnique:
    """Create new instance of appropriate technique from method ID."""
    new = cls._registry[id]
    return new()

to_dict

to_dict() -> dict[str, Any]

Return the technique instance as a new key/value dictionary mapping.

Source code in src/pypalmsens/_methods/base.py
31
32
33
def to_dict(self) -> dict[str, Any]:
    """Return the technique instance as a new key/value dictionary mapping."""
    return self.model_dump()

pypalmsens.mixed_mode.ConstantE


              flowchart TD
              pypalmsens.mixed_mode.ConstantE[ConstantE]
              pypalmsens._methods.mixed_mode.BaseStage[BaseStage]
              pypalmsens._methods.mixins.CurrentLimitsMixin[CurrentLimitsMixin]
              pypalmsens._methods.mixins.MeasurementTriggersMixin[MeasurementTriggersMixin]
              pypalmsens._methods.base_model.BaseModel[BaseModel]

                              pypalmsens._methods.mixed_mode.BaseStage --> pypalmsens.mixed_mode.ConstantE
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixed_mode.BaseStage
                

                pypalmsens._methods.mixins.CurrentLimitsMixin --> pypalmsens.mixed_mode.ConstantE
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.CurrentLimitsMixin
                

                pypalmsens._methods.mixins.MeasurementTriggersMixin --> pypalmsens.mixed_mode.ConstantE
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.MeasurementTriggersMixin
                



              click pypalmsens.mixed_mode.ConstantE href "" "pypalmsens.mixed_mode.ConstantE"
              click pypalmsens._methods.mixed_mode.BaseStage href "" "pypalmsens._methods.mixed_mode.BaseStage"
              click pypalmsens._methods.mixins.CurrentLimitsMixin href "" "pypalmsens._methods.mixins.CurrentLimitsMixin"
              click pypalmsens._methods.mixins.MeasurementTriggersMixin href "" "pypalmsens._methods.mixins.MeasurementTriggersMixin"
              click pypalmsens._methods.base_model.BaseModel href "" "pypalmsens._methods.base_model.BaseModel"
            

Amperometric detection stage.

Apply constant potential during this stage.

Methods:

  • from_stage_type

    Create new instance of appropriate stage from its type.

Attributes:

current_limits class-attribute instance-attribute

current_limits: CurrentLimits = Field(default_factory=CurrentLimits)

Set the current limit settings.

measurement_triggers class-attribute instance-attribute

measurement_triggers: MeasurementTriggers = Field(default_factory=MeasurementTriggers)

Set the trigger at measurement settings.

potential class-attribute instance-attribute

potential: float = 0.0

Potential during measurement in V.

run_time class-attribute instance-attribute

run_time: float = 1.0

Run time of the stage in s.

from_stage_type classmethod

from_stage_type(id: str) -> BaseStage

Create new instance of appropriate stage from its type.

Source code in src/pypalmsens/_methods/mixed_mode.py
31
32
33
34
35
@classmethod
def from_stage_type(cls, id: str) -> BaseStage:
    """Create new instance of appropriate stage from its type."""
    new = cls._registry[str(id)]
    return new()

pypalmsens.mixed_mode.ConstantI


              flowchart TD
              pypalmsens.mixed_mode.ConstantI[ConstantI]
              pypalmsens._methods.mixed_mode.BaseStage[BaseStage]
              pypalmsens._methods.mixins.PotentialLimitsMixin[PotentialLimitsMixin]
              pypalmsens._methods.mixins.MeasurementTriggersMixin[MeasurementTriggersMixin]
              pypalmsens._methods.base_model.BaseModel[BaseModel]

                              pypalmsens._methods.mixed_mode.BaseStage --> pypalmsens.mixed_mode.ConstantI
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixed_mode.BaseStage
                

                pypalmsens._methods.mixins.PotentialLimitsMixin --> pypalmsens.mixed_mode.ConstantI
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.PotentialLimitsMixin
                

                pypalmsens._methods.mixins.MeasurementTriggersMixin --> pypalmsens.mixed_mode.ConstantI
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.MeasurementTriggersMixin
                



              click pypalmsens.mixed_mode.ConstantI href "" "pypalmsens.mixed_mode.ConstantI"
              click pypalmsens._methods.mixed_mode.BaseStage href "" "pypalmsens._methods.mixed_mode.BaseStage"
              click pypalmsens._methods.mixins.PotentialLimitsMixin href "" "pypalmsens._methods.mixins.PotentialLimitsMixin"
              click pypalmsens._methods.mixins.MeasurementTriggersMixin href "" "pypalmsens._methods.mixins.MeasurementTriggersMixin"
              click pypalmsens._methods.base_model.BaseModel href "" "pypalmsens._methods.base_model.BaseModel"
            

Potentiometry stage.

Apply constant fixed current during this stage.

Methods:

  • from_stage_type

    Create new instance of appropriate stage from its type.

Attributes:

applied_current_range class-attribute instance-attribute

applied_current_range: AllowedCurrentRanges = '100uA'

Applied current range.

See pypalmsens.settings.AllowedCurrentRanges for options.

current class-attribute instance-attribute

current: float = 0.0

The current to apply in the given current range.

Note that this value acts as a multiplier in the applied current range.

So if 10 uA is the applied current range and 1.5 is given as current value, the applied current will be 15 uA.

measurement_triggers class-attribute instance-attribute

measurement_triggers: MeasurementTriggers = Field(default_factory=MeasurementTriggers)

Set the trigger at measurement settings.

potential_limits class-attribute instance-attribute

potential_limits: PotentialLimits = Field(default_factory=PotentialLimits)

Set the potential limit settings.

run_time class-attribute instance-attribute

run_time: float = 1.0

Run time of the stage in s.

from_stage_type classmethod

from_stage_type(id: str) -> BaseStage

Create new instance of appropriate stage from its type.

Source code in src/pypalmsens/_methods/mixed_mode.py
31
32
33
34
35
@classmethod
def from_stage_type(cls, id: str) -> BaseStage:
    """Create new instance of appropriate stage from its type."""
    new = cls._registry[str(id)]
    return new()

pypalmsens.mixed_mode.SweepE


              flowchart TD
              pypalmsens.mixed_mode.SweepE[SweepE]
              pypalmsens._methods.mixed_mode.BaseStage[BaseStage]
              pypalmsens._methods.mixins.CurrentLimitsMixin[CurrentLimitsMixin]
              pypalmsens._methods.mixins.MeasurementTriggersMixin[MeasurementTriggersMixin]
              pypalmsens._methods.base_model.BaseModel[BaseModel]

                              pypalmsens._methods.mixed_mode.BaseStage --> pypalmsens.mixed_mode.SweepE
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixed_mode.BaseStage
                

                pypalmsens._methods.mixins.CurrentLimitsMixin --> pypalmsens.mixed_mode.SweepE
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.CurrentLimitsMixin
                

                pypalmsens._methods.mixins.MeasurementTriggersMixin --> pypalmsens.mixed_mode.SweepE
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.MeasurementTriggersMixin
                



              click pypalmsens.mixed_mode.SweepE href "" "pypalmsens.mixed_mode.SweepE"
              click pypalmsens._methods.mixed_mode.BaseStage href "" "pypalmsens._methods.mixed_mode.BaseStage"
              click pypalmsens._methods.mixins.CurrentLimitsMixin href "" "pypalmsens._methods.mixins.CurrentLimitsMixin"
              click pypalmsens._methods.mixins.MeasurementTriggersMixin href "" "pypalmsens._methods.mixins.MeasurementTriggersMixin"
              click pypalmsens._methods.base_model.BaseModel href "" "pypalmsens._methods.base_model.BaseModel"
            

Linear sweep detection stage.

Ramp the voltage from begin_potential to end_potential during this stage.

Methods:

  • from_stage_type

    Create new instance of appropriate stage from its type.

Attributes:

begin_potential class-attribute instance-attribute

begin_potential: float = -0.5

Potential where the scan starts in V.

current_limits class-attribute instance-attribute

current_limits: CurrentLimits = Field(default_factory=CurrentLimits)

Set the current limit settings.

end_potential class-attribute instance-attribute

end_potential: float = 0.5

Potential where the scan stops in V.

measurement_triggers class-attribute instance-attribute

measurement_triggers: MeasurementTriggers = Field(default_factory=MeasurementTriggers)

Set the trigger at measurement settings.

scanrate class-attribute instance-attribute

scanrate: float = 1.0

The applied scan rate. in V/s.

The applicable range depends on the value of step_potential since the data acquisition rate is limited by the connected instrument.

step_potential class-attribute instance-attribute

step_potential: float = 0.1

Potential step in V.

from_stage_type classmethod

from_stage_type(id: str) -> BaseStage

Create new instance of appropriate stage from its type.

Source code in src/pypalmsens/_methods/mixed_mode.py
31
32
33
34
35
@classmethod
def from_stage_type(cls, id: str) -> BaseStage:
    """Create new instance of appropriate stage from its type."""
    new = cls._registry[str(id)]
    return new()

pypalmsens.mixed_mode.OpenCircuit


              flowchart TD
              pypalmsens.mixed_mode.OpenCircuit[OpenCircuit]
              pypalmsens._methods.mixed_mode.BaseStage[BaseStage]
              pypalmsens._methods.mixins.PotentialLimitsMixin[PotentialLimitsMixin]
              pypalmsens._methods.mixins.MeasurementTriggersMixin[MeasurementTriggersMixin]
              pypalmsens._methods.base_model.BaseModel[BaseModel]

                              pypalmsens._methods.mixed_mode.BaseStage --> pypalmsens.mixed_mode.OpenCircuit
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixed_mode.BaseStage
                

                pypalmsens._methods.mixins.PotentialLimitsMixin --> pypalmsens.mixed_mode.OpenCircuit
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.PotentialLimitsMixin
                

                pypalmsens._methods.mixins.MeasurementTriggersMixin --> pypalmsens.mixed_mode.OpenCircuit
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixins.MeasurementTriggersMixin
                



              click pypalmsens.mixed_mode.OpenCircuit href "" "pypalmsens.mixed_mode.OpenCircuit"
              click pypalmsens._methods.mixed_mode.BaseStage href "" "pypalmsens._methods.mixed_mode.BaseStage"
              click pypalmsens._methods.mixins.PotentialLimitsMixin href "" "pypalmsens._methods.mixins.PotentialLimitsMixin"
              click pypalmsens._methods.mixins.MeasurementTriggersMixin href "" "pypalmsens._methods.mixins.MeasurementTriggersMixin"
              click pypalmsens._methods.base_model.BaseModel href "" "pypalmsens._methods.base_model.BaseModel"
            

Open Circuit stage.

Measure the open circuit potential during this stage.

Methods:

  • from_stage_type

    Create new instance of appropriate stage from its type.

Attributes:

measurement_triggers class-attribute instance-attribute

measurement_triggers: MeasurementTriggers = Field(default_factory=MeasurementTriggers)

Set the trigger at measurement settings.

potential_limits class-attribute instance-attribute

potential_limits: PotentialLimits = Field(default_factory=PotentialLimits)

Set the potential limit settings.

run_time class-attribute instance-attribute

run_time: float = 1.0

Run time of the stage in s.

from_stage_type classmethod

from_stage_type(id: str) -> BaseStage

Create new instance of appropriate stage from its type.

Source code in src/pypalmsens/_methods/mixed_mode.py
31
32
33
34
35
@classmethod
def from_stage_type(cls, id: str) -> BaseStage:
    """Create new instance of appropriate stage from its type."""
    new = cls._registry[str(id)]
    return new()

pypalmsens.mixed_mode.Impedance


              flowchart TD
              pypalmsens.mixed_mode.Impedance[Impedance]
              pypalmsens._methods.mixed_mode.BaseStage[BaseStage]
              pypalmsens._methods.base_model.BaseModel[BaseModel]

                              pypalmsens._methods.mixed_mode.BaseStage --> pypalmsens.mixed_mode.Impedance
                                pypalmsens._methods.base_model.BaseModel --> pypalmsens._methods.mixed_mode.BaseStage
                



              click pypalmsens.mixed_mode.Impedance href "" "pypalmsens.mixed_mode.Impedance"
              click pypalmsens._methods.mixed_mode.BaseStage href "" "pypalmsens._methods.mixed_mode.BaseStage"
              click pypalmsens._methods.base_model.BaseModel href "" "pypalmsens._methods.base_model.BaseModel"
            

Electostatic impedance stage.

This is like EIS with a single frequency step (scan_type = 'fixed', freq_type = 'fixed').

Methods:

  • from_stage_type

    Create new instance of appropriate stage from its type.

Attributes:

ac_potential class-attribute instance-attribute

ac_potential: float = 0.01

AC potential in V RMS.

The amplitude of the AC signal has a range of 0.0001 V to 0.25 V (RMS). In many applications, a value of 0.010 V (RMS) is used. The actual amplitude must be small enough to prevent a current response with considerable higher harmonics of the applied ac frequency.

dc_potential class-attribute instance-attribute

dc_potential: float = 0.0

DC potential applied during the scan in V.

frequency class-attribute instance-attribute

frequency: float = 50000.0

Fixed frequency in Hz.

max_equilibration_time class-attribute instance-attribute

max_equilibration_time: float = 5.0

Max equilibration time in s.

The EIS measurement requires a stationary state. This means that before the actual measurement starts, the sine wave is applied during max_equilibration_time only to reach the stationary state.

The maximum number of equilibration sine waves is however 5.

The minimum number of equilibration sines is set to 1, but for very low frequencies, this time is limited by max_equilibration_time.

The maximum time to wait for stationary state is determined by the value of this parameter. A reasonable value might be 5 seconds. In this case this parameter is only relevant when the lowest frequency is less than 1/5 s so 0.2 Hz.

min_sampling_time class-attribute instance-attribute

min_sampling_time: float = 0.5

Minimum sampling time in s.

Each measurement point of the impedance spectrum is performed during the period specified by min_sampling_time.

This means that the number of measured sine waves is equal to min_sampling_time * frequency. If this value is less than 1 sine wave, the sampling is extended to 1 / frequency.

So for a measurement at a frequency, at least one complete sine wave is measured. Reasonable values for the sampling are in the range of 0.1 to 1 s.

run_time class-attribute instance-attribute

run_time: float = 10.0

Run time of the scan in s.

from_stage_type classmethod

from_stage_type(id: str) -> BaseStage

Create new instance of appropriate stage from its type.

Source code in src/pypalmsens/_methods/mixed_mode.py
31
32
33
34
35
@classmethod
def from_stage_type(cls, id: str) -> BaseStage:
    """Create new instance of appropriate stage from its type."""
    new = cls._registry[str(id)]
    return new()