Skip to content

error for numeric value in until_after_sources list #3132

@leSemaleon

Description

@leSemaleon

I want to use multiple conditions to end the simulation. The documentation supports a list of conditions.

I tried using the following code to start the simulation:

sim.run(until_after_sources=[
                           mp.stop_when_fields_decayed(10, field_component,
                                                      mp.Vector3(0, 0, sz/2-dpml-0.5*dAirOut),
                                                      accuracityOfDecay), 
                           10000
                           ]
       )

But it returned the error "'int' object is not callable."

Details
File "*/miniconda/envs/mp/lib/python3.13/site-packages/meep/simulation.py", line 4544, in run
    self._run_sources_until(until_after_sources, step_funcs)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "*/miniconda/envs/mp/lib/python3.13/site-packages/meep/simulation.py", line 2880, in _run_sources_until
    self._run_until(new_conds, step_funcs)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "*/miniconda/envs/mp/lib/python3.13/site-packages/meep/simulation.py", line 2835, in _run_until
    while not any([x(self) for x in cond]):
                   ~^^^^^^
  File "*/miniconda/envs/mp/lib/python3.13/site-packages/meep/simulation.py", line 2876, in f
    return cond[i](sim) and sim.round_time() >= ts
           ~~~~~~~^^^^^
TypeError: 'int' object is not callable

If I move the condition with the number up, the error disappears and everything starts as expected.

sim.run(until_after_sources=[10000,
                           mp.stop_when_fields_decayed(10, field_component,
                                                      mp.Vector3(0, 0, sz/2-dpml-0.5*dAirOut),
                                                      accuracityOfDecay), 
                           ]
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions