Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update octagon.py #320

wants to merge 1 commit into from

Conversation

jerlich
Copy link
Contributor

@jerlich jerlich commented Feb 2, 2024

We extended the API to include a new stimulus type.

Summary by CodeRabbit

  • New Feature: Added a new functionality to the Stimulus class in the aeon/schema/octagon.py file. This feature introduces a static method checkerboard_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.

We extended the API to include a new stimulus type.
Copy link

github-actions bot commented Feb 2, 2024

Image description CodeRabbit

Walkthrough

The proposed changeset introduces a new static method checkerboard_slice_onset to the Stimulus class in the aeon/schema/octagon.py file. This method returns a dictionary with a key-value pair, where the key is "CheckerboardSliceOnset" and the value is an instance of _reader.Harp. The change extends the API's functionality to support checkerboard slice onset stimuli.

Changes

File Summary
aeon/schema/octagon.py A new static method checkerboard_slice_onset has been added to the Stimulus class. This method returns a dictionary with the key "CheckerboardSliceOnset" and a value of an instance of _reader.Harp, extending the API to support checkerboard slice onset stimuli.

Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If 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.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 616155b and 5502629 commits.
Files selected (1)
  • aeon/schema/octagon.py (1)
Review comments generated (1)
  • Review: 1
  • LGTM: 0

Tips

Chat with Image description 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.

Comment on lines +130 to +132
@staticmethod
def checkerboard_slice_onset(pattern):
return {"CheckerboardSliceOnset": _reader.Harp(f"{pattern}_14_*", columns=["wall_id"])}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant