Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pygwinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container Registry
Model registry
Operate
Environments
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
gwinc
pygwinc
Commits
5fd28791
Commit
5fd28791
authored
5 years ago
by
Jameson Graef Rollins
Browse files
Options
Downloads
Patches
Plain Diff
nb: simplify BudgetItem freq attirbute access
Allows for specifying as a class attribute.
parent
1597e718
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!64
No more precomp
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gwinc/nb.py
+11
-10
11 additions, 10 deletions
gwinc/nb.py
with
11 additions
and
10 deletions
gwinc/nb.py
+
11
−
10
View file @
5fd28791
...
...
@@ -52,15 +52,21 @@ class BudgetItem:
##########
def
__init__
(
self
,
freq
,
**
kwargs
):
def
__init__
(
self
,
freq
=
None
,
**
kwargs
):
"""
Initialize budget item.
Primary argument is the evaluation frequency array. Any
keyword arguments provided are simple written as attribute
variables in the initialized object.
The primary argument should be the evaluation frequency array.
If it is not provided, then it is assumed to be a pre-defined
attribute of the BudgetItem class. Any keyword arguments
provided are simple written as attribute variables in the
initialized object.
"""
self
.
__freq
=
freq
if
freq
is
not
None
:
assert
isinstance
(
freq
,
np
.
ndarray
)
self
.
freq
=
freq
elif
not
hasattr
(
self
,
'
freq
'
):
raise
AttributeError
(
"
Frequency array not provided or defined.
"
)
for
key
,
val
in
kwargs
.
items
():
setattr
(
self
,
key
,
val
)
...
...
@@ -76,11 +82,6 @@ class BudgetItem:
self
.
name
,
)
@property
def
freq
(
self
):
"""
Evaluation frequency array supplied at initialization.
"""
return
self
.
__freq
def
interpolate
(
self
,
freq
,
data
):
"""
Interpolate data to the evaluation frequencies.
...
...
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