-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean-up Experiment dependencies inside Stimulus #72
Draft
fedem-p
wants to merge
13
commits into
master
Choose a base branch
from
clean_exp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6fc6347
calibrator initialized from the protocol runner;
fedem-p 4e96d16
Added warning for deprecated function inputs
fedem-p 8e79c62
Cleaned useless comments
fedem-p 516d893
added EnvironmentState dataclass;
fedem-p 884016a
Move data class;
fedem-p e4ffdf0
updated variable name;
fedem-p 03a99bc
Updated calibrator variable
fedem-p bad8037
added estimator log variable;
fedem-p 6db29ec
removed useless comments
fedem-p 7d9cf14
change msg for deprecation
fedem-p f1b545b
added params to env_state var;
fedem-p 1f3c8cb
updated access to new params;
fedem-p 27e377a
Included trigger inside environment state variable
fedem-p File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import numpy as np | ||
import datetime | ||
import warnings | ||
|
||
|
||
class Stimulus: | ||
|
@@ -66,6 +67,7 @@ def __init__(self, duration=0.0): | |
self._elapsed = 0.0 # time from the beginning of the stimulus | ||
self.name = "undefined" | ||
self._experiment = None | ||
self._calibrator = None | ||
self.real_time_start = None | ||
self.real_time_stop = None | ||
|
||
|
@@ -111,7 +113,7 @@ def stop(self): | |
""" | ||
pass | ||
|
||
def initialise_external(self, experiment): | ||
def initialise_external(self, experiment, calibrator = -999): | ||
fedem-p marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" Make a reference to the Experiment class inside the Stimulus. | ||
This is required to access from inside the Stimulus class to the | ||
Calibrator, the Pyboard, the asset directories with movies or the motor | ||
|
@@ -130,7 +132,18 @@ def initialise_external(self, experiment): | |
None | ||
|
||
""" | ||
|
||
if calibrator == -999: | ||
self._calibrator = self._experiment.calibrator | ||
warnings.warn("Warning: 'initialise_external' will require a calibrator input from the new update!", FutureWarning) | ||
warnings.warn("Warning: 'initialise_external' will require a calibrator input from the new update!", DeprecationWarning) | ||
else: | ||
self._calibrator = calibrator | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix 2 |
||
self._experiment = experiment | ||
|
||
|
||
|
||
|
||
class DynamicStimulus(Stimulus): | ||
|
@@ -289,10 +302,10 @@ def update(self): | |
s.update() | ||
s._elapsed = self._elapsed | ||
|
||
def initialise_external(self, experiment): | ||
super().initialise_external(experiment) | ||
def initialise_external(self, experiment, calibrator): | ||
super().initialise_external(experiment, calibrator) | ||
for s in self._stim_list: | ||
s.initialise_external(experiment) | ||
s.initialise_external(experiment, calibrator) | ||
|
||
@property | ||
def dynamic_parameter_names(self): | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIX 1