lincc-frameworks / tdastro

MIT License
4 stars 0 forks source link

Allow accessing of attributes with other names #41

Closed jeremykubica closed 4 months ago

jeremykubica commented 4 months ago

This PR makes two changes to the API.

First, it allows a ParameterizedNode to access attributes with arbitrary names from other ParameterizedNodes. Previously it was assumed the attribute would have the same name in both ParameterizedNodes. This extension is done by allowing a parameter to take a (ParameterizedNode, str) tuple indicating which attribute to access.

For example:

my_model = MyModel(arg1=(other_model, `arg9`))

will set my_model.arg1 = other_model.arg9.

Second, arguments natively handle FunctionNodes so the user does not need to pass compute each time.