-
Notifications
You must be signed in to change notification settings - Fork 6
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 octagon.py #320
base: main
Are you sure you want to change the base?
Update octagon.py #320
Conversation
We extended the API to include a new stimulus type.
WalkthroughThe proposed changeset introduces a new static method Changes
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
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.
Files selected (1)
- aeon/schema/octagon.py (1)
Review comments generated (1)
- Review: 1
- LGTM: 0
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
@staticmethod | ||
def checkerboard_slice_onset(pattern): | ||
return {"CheckerboardSliceOnset": _reader.Harp(f"{pattern}_14_*", columns=["wall_id"])} |
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 new method checkerboard_slice_onset
is almost identical to the existing method gratings_slice_onset
. This violates the DRY (Don't Repeat Yourself) principle. You can refactor these methods into a single method that takes an additional parameter for the stimulus type. Here's a suggested change:
- @staticmethod
- def gratings_slice_onset(pattern):
- return {"GratingsSliceOnset": _reader.Harp(f"{pattern}_12_*", columns=["wall_id"])}
-
- @staticmethod
- def checkerboard_slice_onset(pattern):
- return {"CheckerboardSliceOnset": _reader.Harp(f"{pattern}_14_*", columns=["wall_id"])}
+ @staticmethod
+ def slice_onset(stimulus_type, pattern):
+ if stimulus_type == "Gratings":
+ return {f"{stimulus_type}SliceOnset": _reader.Harp(f"{pattern}_12_*", columns=["wall_id"])}
+ elif stimulus_type == "Checkerboard":
+ return {f"{stimulus_type}SliceOnset": _reader.Harp(f"{pattern}_14_*", columns=["wall_id"])}
+ else:
+ raise ValueError("Invalid stimulus type")
This way, you can add more stimulus types in the future without adding more methods.
We extended the API to include a new stimulus type.
Summary by CodeRabbit
Stimulus
class in theaeon/schema/octagon.py
file. This feature introduces a static methodcheckerboard_slice_onset
that extends our API's capabilities to support checkerboard slice onset stimuli. This enhancement will provide users with more flexibility and control when working with different types of stimuli.