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

Option to suppress REAPER output #2

Closed
terriyu opened this issue Nov 16, 2017 · 5 comments
Closed

Option to suppress REAPER output #2

terriyu opened this issue Nov 16, 2017 · 5 comments

Comments

@terriyu
Copy link

terriyu commented Nov 16, 2017

Hi,

Is there any method I can use to suppress printing statements like

Residual symmetry: P:2468.209473  N:1539.423462  MEAN:0.045802
Inverting signal

when I run pyreaper.reaper()?

I tried using a context like this:

class DummyFile(object):
    def write(self, x): pass

@contextlib.contextmanager
def suppress_print():
    save_stdout = sys.stdout
    save_stderr = sys.stderr
    sys.stdout = DummyFile()
    sys.stderr = DummyFile()
    yield
    sys.stdout = save_stdout
    sys.stderr = save_stderr

but it doesn't work. I guess since cython is used, the output is going through somewhere else besides stdout.

@terriyu
Copy link
Author

terriyu commented Nov 17, 2017

I found this post which explains that C level streams need special handling. Unfortunately, I haven't gotten it to work in all cases that I need.

@r9y9
Copy link
Owner

r9y9 commented Nov 17, 2017

The easiest way I can think of is to remove fprintf lines in REAPER (https://github.com/google/REAPER/blob/b171300c077be1098cc2fb5d440ee244bd5a4c39/epoch_tracker/epoch_tracker.cc#L766-L769) itself and re-build cython module.

@terriyu
Copy link
Author

terriyu commented Nov 17, 2017

Thanks for that idea. Can I fork your repo and try removing the lines?

@r9y9
Copy link
Owner

r9y9 commented Nov 17, 2017

Sure!

@terriyu
Copy link
Author

terriyu commented Nov 19, 2017

It worked, thank you!

@terriyu terriyu closed this as completed Nov 19, 2017
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

No branches or pull requests

2 participants