-
Notifications
You must be signed in to change notification settings - Fork 38
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
update C++ codebase for handling of feature dependencies [vcs: #minor] #334
Conversation
This reverts commit 954613a.
@darshanmandge, @AurelienJaquier I tried to address all of your reviews. Could you take another look to ensure the modifications align with your expectations? |
return spike_count() | ||
|
||
|
||
def spike_count() -> numpy.ndarray: |
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.
Is there a reason to have a new spike_count
feature and deprecating Spikecount
? Also since it stays as Spikecount
in the documentation.
Same question for Spikecount_stimint
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.
In the future I thought keeping Python naming convention would be better. I wanted to deprecate it now so that if we change the naming convention in the future we can say: this was deprecated 2 major releases ago
.
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.
Ideally all features should have a consistent naming. Most of them are underscore separated already e.g.
adaptation_index
or ohmic_input_resistance
. Spikecount
was an exception. What do you think?
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.
Alright, sounds good. But then maybe we should update the documentation also.
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.
I see Spikecount
has been used in several places in BluePyOpt and BluePyEModel. There can be lot of warnings from old code at multiple places as it is one of the most common features.
Do all the other features follow consistent naming convention? If not, can we keep the name and feature Spikecount
?
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.
Ok. Thanks!
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.
While testing bluepyopt, bluepyefe, bluepyemodel I will make sure this warning does not occur multiple times.
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.
Shouldn't you add spike_count in all_pyfeatures to make it a valid feature? If you want to deprecate Spikecount I mean. Also modify documentation so that feature name is spike_count while keeping a note for Spikecount explaining that it is deprecated.
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.
I think "spike_count" is there already.
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.
Updating the docs
Before merging this PR, can you check if works correctly with BluePyOpt, BluePyEfe and BluePyEModel e.g. the tests and examples? This would be another level of check to ensure eFEL works well with these software. :) |
Downstream workflows to be tested before merging this PR:
bluepyefepy3: OK (56.08=setup[49.34]+cmd[6.75] seconds) bluepyopt==================================================================== 180 passed, 12 deselected, 16 warnings in 19.54s ===================================================================== bluepyemodel========================================================================= 75 passed, 52 warnings in 176.40s (0:02:56) ========================================================================== |
This reverts commit 41b087e.
tests/test_basic.py
Outdated
@@ -1711,6 +1711,8 @@ def test_getFeatureNames(): | |||
test_data_path = testdata_dir.parent / 'featurenames.json' | |||
with open(test_data_path, 'r') as featurenames_json: | |||
expected_featurenames = json.load(featurenames_json) | |||
# add the new names for the deprecated ones | |||
expected_featurenames += ["spike_count", "spike_count_stimint"] |
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.
The featurenames_json should reflect all the features that we have. If we don't want to duplicate spike_count, it would be better I think to have spike_count in the file, and add deprecated Spikecount in code here to legacy, instead of the inverse as we have now
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.
Ok makes sense so renaming Spikecount -> spike_count in the file.
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.
Done in the last push.
tests/test_cppcore.py
Outdated
@@ -97,6 +97,8 @@ def test_getFeatureNames(self): # pylint: disable=R0201 | |||
test_data_path = os.path.join(testdata_dir, '../featurenames.json') | |||
with open(test_data_path, 'r') as featurenames_json: | |||
expected_featurenames = json.load(featurenames_json) | |||
# add the new names for the deprecated ones | |||
expected_featurenames += ["spike_count", "spike_count_stimint"] |
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.
Same as comment above
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.
Updated in the latest push.
docs/source/eFeatures.rst
Outdated
|
||
number of spikes in the trace, including outside of stimulus interval | ||
|
||
- **Required features**: LibV1:peak_indices | ||
- **Units**: constant | ||
- **Pseudocode**: :: | ||
|
||
Spikecount = len(peak_indices) | ||
spike_count = len(peak_indices) | ||
|
||
**Note**: In the future this feature will be called "spike_count". |
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.
Could you please tell in the note that this feature replaces Spikecount, that Spikecount is deprecated, but can still be used for the moment?
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.
Ah yes, I also noticed I forgot to update this one. Done in the last commit. 👍
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.
Great job!
Changes
Following up on #321, focusing on the handling of feature dependencies.
getFeatures Function for Enhanced Dependency Handling
Consistent Result Differentiation: The updated
getFeatures
now consistently distinguishes between empty results and actual failures.Restricted Access for Safety: The introduction of constant (
const
) access modifiers in the new implementation restricts unnecessary access to feature data, preventing unintended changes.Centralized Exception and Missing Value Handling: Exceptions and missing values are now handled once for all features in a unified manner, replacing the previous approach where each feature managed these issues separately. This consistency streamlines error handling and arguably improves code readability.
Before
After
Simplifying Variable Handling
Eliminating Unnecessary Wildcards
"location_AIS"
as a wildcard in C++. Such explicit use is redundant when we interface with Python.Merging efel.h/efel.cpp into cppcore
Embracing Flexibility with Templates
getIntParam
andgetDoubleParam
with a unifiedgetParam
.Update:
14.12.2023
Added more clarity on the removal of E* features by quoting @darshanmandge .
The names of those features are as follows: "E6 E7 E39 E39_cod E2 E3 E4 E5 E8 E9 E10 E11 E12 E13 E14 E15 E16 E17 E18 E19 E20 E21 E22 E23 E24 E25 E26 E27 E40"
08.01.2024
bpap_attenuation
feature is added to the Python API.Spikecount
,Spikecount_stimint
,burst_number
andstrict_burst_number
features migrated to Python from C++.check_ais_initiation
is added to the Python API.