Skip to content

Fix element-wise comparison for grad_lib_values in write_seq.py#30

Open
josalggui wants to merge 1 commit intomri4all:mainfrom
josalggui:patch_1
Open

Fix element-wise comparison for grad_lib_values in write_seq.py#30
josalggui wants to merge 1 commit intomri4all:mainfrom
josalggui:patch_1

Conversation

@josalggui
Copy link

Description

This pull request fixes an issue with element-wise comparison in the write_seq.py code.

Problem

The original code compares the entire list grad_lib_values to the string 'g', which results in False instead of an element-wise comparison in some cases depending on python or libraries versions. When if any(arb_grad_mask) is called, False gives rise an error, while an empty list works properly.

Solution

Updated the code to use a list comprehension to perform element-wise comparison:

arb_grad_mask = [value == 'g' for value in grad_lib_values]
trap_grad_mask = [value == 't' for value in grad_lib_values]

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