-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from Ciela-Institute/simulatorclass
Added Simulator class object
- Loading branch information
Showing
5 changed files
with
31 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from .parameterized import Parametrized | ||
|
||
__all__ = ("Simulator", ) | ||
|
||
class Simulator(Parametrized): | ||
"""A caustic simulator using Parametrized framework. | ||
Defines a simulator class which is a callable function that | ||
operates on the Parametrized framework. Users define the `forward` | ||
method which takes as its first argument an object which can be | ||
packed, all other args and kwargs are simply passed to the forward | ||
method. | ||
See `Parametrized` for details on how to add/access parameters. | ||
""" | ||
def __call__(self, *args, **kwargs): | ||
return self.forward(self.pack(args[0]), *args[1:], **kwargs) |