Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pygwinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Kuns
pygwinc
Commits
2c88b04c
Commit
2c88b04c
authored
3 years ago
by
Kevin Kuns
Browse files
Options
Downloads
Patches
Plain Diff
fix bug when updating ifo struct in budget run
parent
c0d8fb3b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#326239
passed
3 years ago
Stage: dist
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gwinc/nb.py
+1
-1
1 addition, 1 deletion
gwinc/nb.py
test/budgets/test_budgets.py
+35
-0
35 additions, 0 deletions
test/budgets/test_budgets.py
with
36 additions
and
1 deletion
gwinc/nb.py
+
1
−
1
View file @
2c88b04c
...
...
@@ -271,7 +271,7 @@ class Noise(BudgetItem):
ifo_hash
=
ifo
.
hash
(
ifo
.
_orig_keys
)
if
ifo_hash
!=
getattr
(
self
,
'
_ifo_hash
'
,
0
):
logger
.
debug
(
"
ifo hash change
"
)
kwargs
[
'
ifo
'
]
=
self
.
ifo
kwargs
[
'
ifo
'
]
=
ifo
self
.
_ifo_hash
=
ifo_hash
if
kwargs
:
...
...
This diff is collapsed.
Click to expand it.
test/budgets/test_budgets.py
+
35
−
0
View file @
2c88b04c
"""
"""
import
numpy
as
np
import
gwinc
from
gwinc
import
load_budget
from
copy
import
deepcopy
import
pytest
def
test_load
(
pprint
,
tpath_join
,
fpath_join
):
...
...
@@ -12,3 +15,35 @@ def test_load(pprint, tpath_join, fpath_join):
fig
=
trace
.
plot
()
fig
.
savefig
(
tpath_join
(
'
budget_{}.pdf
'
.
format
(
ifo
)))
@pytest.mark.logic
@pytest.mark.fast
def
test_update_ifo_struct
():
"""
Test that the noise is recalculated when the ifo struct is updated
"""
budget
=
gwinc
.
load_budget
(
'
CE2silica
'
)
tr1
=
budget
.
run
()
budget
.
ifo
.
Suspension
.
VHCoupling
.
theta
*=
2
tr2
=
budget
.
run
()
assert
np
.
all
(
tr2
.
Seismic
.
SeismicVertical
.
asd
==
2
*
tr1
.
Seismic
.
SeismicVertical
.
asd
)
@pytest.mark.logic
@pytest.mark.fast
def
test_change_ifo_struct
():
"""
Test that the noise is recalculated when a new ifo struct is passed to run
"""
budget
=
gwinc
.
load_budget
(
'
CE2silica
'
)
ifo1
=
deepcopy
(
budget
.
ifo
)
ifo2
=
deepcopy
(
budget
.
ifo
)
ifo2
.
Suspension
.
VHCoupling
.
theta
*=
2
tr1
=
budget
.
run
(
ifo
=
ifo1
)
tr2
=
budget
.
run
(
ifo
=
ifo2
)
tr3
=
budget
.
run
(
ifo
=
ifo1
)
assert
np
.
all
(
tr1
.
asd
==
tr3
.
asd
)
assert
np
.
all
(
tr2
.
Seismic
.
SeismicVertical
.
asd
==
2
*
tr1
.
Seismic
.
SeismicVertical
.
asd
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment