-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Description
Sometimes it's useful to be able to copy a network, particularly given we have mutating methods. As a motivating example, consider the global s_pombe network. If the user computes the its attractors, the result is cached inside of the global s_pombe object. This is bad hygiene!
Proposed API
class Network(LandscapeMixin, StateSpace):
@abstractmethod
def clone(self):
pass
class WTNetwork(BooleanNetwork):
def clone(self):
return WTNetwork(np.copy(self.weights),
np.copy(self.thresholds),
np.copy(self.names),
self.theta)Example Usage
>>> from neet.boolean.examples import s_pombe
>>> s_pombe_copy = s_pombe.clone()
<neet.boolean.wtnetwork.WTNetwork object at 0x...>
>>> s_pombe_copy.landscape()
<neet.boolean.wtnetwork.WTNetwork object at 0x...>
>>> s_pombe.landscape_data
None
>>> s_pombe_copy.landscape_data
<neet.landscape.LandscapeData object at 0x...>Metadata
Metadata
Assignees
Labels
No labels