Support for frequency domain injections
Created by: alurban
@duncanmmacleod This PR adds a method, Series.inject()
, which allows for both time and frequency domain injections. Its invocation replaces TimeSeries.inject()
(see pull request https://github.com/gwpy/gwpy/pull/720) by moving the inject()
method into the parent Series
class. In the frequency domain, the behavior is designed such that other.frequencies
must be a subset of self.frequencies
. In other words, signals that trail off past self.f0
or self.f0 + self.size*self.df
will raise a ValueError
. The method's behavior in the time domain remains unchanged.
This PR also adds a unit test and two example use cases, which would be added to the examples
directory.
Merge request reports
Activity
Created by: pep8speaks
Hello @alurban! Thanks for updating the PR.
- In the file
examples/frequencyseries/inject.py
, following are the PEP8 issues :
Line 48:1: E402 module level import not at top of file Line 49:1: E402 module level import not at top of file Line 55:1: E402 module level import not at top of file Line 62:1: E402 module level import not at top of file
- In the file
examples/timeseries/inject.py
, following are the PEP8 issues :
Line 44:1: E402 module level import not at top of file Line 62:1: E402 module level import not at top of file
- In the file
gwpy/tests/test_frequencyseries.py
, following are the PEP8 issues :
Line 52:80: E501 line too long (93 > 79 characters)
- In the file
gwpy/types/series.py
, following are the PEP8 issues :
Line 665:26: E721 do not compare types, use 'isinstance()'
Comment last updated on April 12, 2018 at 23:05 Hours UTC
- In the file
@alurban, this PR begs the question of whether the relevant inject method should be moved upstream to the
Series
, which is the parent class for both theTimeSeries
andFrequencySeries
, so we don't have to maintain two independent implementations of essentially the same method. Can you have a go at making it xunit-agnostic and moving it up?Created by: alurban
@duncanmmacleod, sure, I'll have a go at that this afternoon. It should be ready for you to look over tomorrow morning your time
Created by: alurban
@duncanmmacleod, I've taken a stab at making the method xunit-agnostic. The one small hitch is that, if the
Series
are in the time domain, it will attempt to crop them to reflect the behavior in #720 . This currently gives the method a complexity of 6 which fails the codeclimate test. Are you ok with that?I've also moved injection examples over to
examples/
, which seemed like the appropriate place to put them.Created by: alurban
@duncanmmacleod, I've managed to refactor a nested if statement in
types.series.Series.inject()
to reduce its cognitive complexity. After this change, the PR passes codeclimate's test. I've also checked that the new method reproduces the behavior of the old method you approved in #720 .assigned to @duncanmmacleod
added gwpy.timeseries gwpy.types + 1 deleted label
changed milestone to %0.10.0