Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BEA data analysis utils
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
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
Philipp Niedermayer
BEA data analysis utils
Commits
e6d10897
Commit
e6d10897
authored
2 years ago
by
Philipp Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
Support rad and deg NWA data
parent
e5f742db
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
data.py
+5
-2
5 additions, 2 deletions
data.py
with
5 additions
and
2 deletions
data.py
+
5
−
2
View file @
e6d10897
...
...
@@ -326,12 +326,13 @@ class NWAData(Trace):
p_unit
:
str
=
'
a.u.
'
@classmethod
def
from_file
(
cls
,
magfile
,
phasefile
=
None
,
unwrap
=
False
,
verbose
=
0
):
def
from_file
(
cls
,
magfile
,
phasefile
=
None
,
*
,
isdeg
=
True
,
unwrap
=
False
,
verbose
=
0
):
"""
Read in data from CSV file for magnitude and phase
:param magfile: path to filename with magnitude trace data
:param phasefile: path to filename with phase trace data. If None, phase data is assumed to be the second column in magfile.
:param unwrap: if true, relative phase is unwraped to absolute phase centered around zero
:param isdeg: if phase data is in degree (True) or radians (False)
"""
f
,
m
,
*
other
=
np
.
loadtxt
(
magfile
,
skiprows
=
3
,
delimiter
=
'
,
'
).
T
if
phasefile
is
None
:
...
...
@@ -342,8 +343,10 @@ class NWAData(Trace):
raise
ValueError
(
'
Files provided do not have equal frequency components.
'
)
if
unwrap
:
if
isdeg
:
p
=
np
.
deg2rad
(
p
)
p
=
np
.
unwrap
(
p
)
p
-=
np
.
mean
(
p
)
if
isdeg
:
p
=
np
.
rad2deg
(
p
)
return
NWAData
(
f
,
m
,
p
)
return
NWAData
(
f
,
m
,
p
,
p_unit
=
'
deg
'
if
isdeg
else
'
rad
'
)
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