Skip to content

set_dynamic_time_fn() does not set dynamic time_fn #668

Description

@AQ18

ALL software version info

param 1.12.2

Description of expected behavior and the observed behavior

From the API reference:

set_dynamic_time_fn(time_fn, sublistattr=None)[source]
Set time_fn for all Dynamic Parameters of this class or instance object that are currently being dynamically generated.

Either I am completely misunderstanding this/using it wrong, or it just doesn't do that. The time_fn is unaffected.

Additionally, sets _Dynamic_time_fn=time_fn on this class or instance object, ...

This is true.

... so that any future changes to Dynamic Parmeters can inherit time_fn (e.g. if a Number is changed from a float to a number generator, the number generator will inherit time_fn).

But this is not.

Complete, minimal, self-contained example code that reproduces the issue

import param
import numbergen as ng

class Foo(param.Parameterized):
    a = param.Dynamic()

print(Foo.param.a.time_fn)
    
foo = Foo()
print(foo.param.a.time_fn)

time = param.Time()
print(time)

Foo.param.set_dynamic_time_fn(time)
print(Foo.param.a.time_fn) # This has not changed

foo.param.set_dynamic_time_fn(time)
print(foo.param.a.time_fn) # This has not changed

print(Foo._Dynamic_time_fn) # This did get set
foo2 = Foo()
print(foo2.param.a.time_fn) # But was not set on the new instance parameter
foo2.a = ng.UniformRandom()
print(foo2.param.a.time_fn) # Nor set on change
<Time Time00001>
<Time Time00001>
<Time Time00003>
<Time Time00001>
<Time Time00001>
<Time Time00003>
<Time Time00001>
<Time Time00001>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions