precomp decorator support
Precomp functions are specified with the @nb.precomp decorator to BudgetItem.calc() methods. The are supplied with the freq array and the ifo struct, their output are supplied as keyword arguments to the wrapped calc(), and their output is cached to prevent re-calculating the same functions multiple time per budget run.
Merge request reports
Activity
added 3 commits
-
a52b1d06...83625807 - 2 commits from branch
gwinc:master
- 97afd5d6 - precomp support
-
a52b1d06...83625807 - 2 commits from branch
I like this a lot. It will make the quantum noise sub-budget MR !94 (merged) simpler and the suspension thermal noise sub-budgets that I'm working on considerably simpler. It also prevents all of the current coating and substrate thermal noise calculations from calling their precomp's over each time one of them is called.
If I understand correctly, all of the precomp functions should be of the form
def precomp(f, ifo): ...
I think this is fine and can't think of a reason why this would be an issue.
I really like this change, but I think there's a bug when using the
update
method of thenb.Noise
class. Something to be addressed after all the API changes.The following
class MeasuredNoise(nb.Noise): def update(self, fname='data.txt'): ff, asd = np.loadtxt(fname) self.data = self.interpolate(ff, asd**2) def calc(self): return self.data class MyBudget(nb.Budget): noises = [ QuantumVacuum, MeasuredNoise ] calibrations = [ Strain, ]
works on master but gives the error
TypeError: update() got an unexpected keyword argument '_precomp'
here. It works if the data is loaded with the
load
method without the keyword argument instead.added 17 commits
-
97afd5d6...94f24df2 - 13 commits from branch
gwinc:master
- e6b933f6 - API change: Budget/Noise calculations return BudgetTrace object
- 066f849b - precomp decorator support
- da92dde8 - ifo hash and Noise.run() opportunistically run update()
- ac747cd4 - Noise.run() opportunistically call load()
Toggle commit list-
97afd5d6...94f24df2 - 13 commits from branch
added 7 commits
-
49ee02f9...6348af30 - 3 commits from branch
gwinc:master
- e56766a1 - API change: Budget/Noise calculations return BudgetTrace object
- af2cd1e5 - precomp decorator support
- 97950a2a - ifo hash and Noise.run() opportunistically run update()
- f93fa168 - Noise.run() opportunistically call load()
Toggle commit list-
49ee02f9...6348af30 - 3 commits from branch
mentioned in merge request !100 (closed)
added 6 commits
-
72d32f32...4a0c13b3 - 2 commits from branch
gwinc:master
- 51158ce4 - API change: Budget/Noise calculations return BudgetTrace object
- 3b24efc3 - precomp decorator support
- f5279568 - ifo hash and Noise.run() opportunistically run update()
- 1e619807 - Noise.run() opportunistically call load()
Toggle commit list-
72d32f32...4a0c13b3 - 2 commits from branch
With @lee-mcculler's help, this new version provides mapped output for the precomp functions so that they don't need to modify the ifo struct, which is much cleaner. I'm pretty happy with this version.
Some of the noise calculation function argument signatures did need to be modified, though, to accept extra arguments. Small price to pay it seem, though...
Edited by Jameson Rollins