Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-spectrometer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QuTech
python-spectrometer
Commits
bf6197a6
Verified
Commit
bf6197a6
authored
6 months ago
by
Tobias Hangleiter
Browse files
Options
Downloads
Patches
Plain Diff
Fix complex_data for readonly daq
parent
2110ae5d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!56
Add live view tool
Pipeline
#1633575
passed
6 months ago
Stage: deploy
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/python_spectrometer/_plot_manager.py
+16
-2
16 additions, 2 deletions
src/python_spectrometer/_plot_manager.py
src/python_spectrometer/core.py
+6
-1
6 additions, 1 deletion
src/python_spectrometer/core.py
with
22 additions
and
3 deletions
src/python_spectrometer/_plot_manager.py
+
16
−
2
View file @
bf6197a6
...
...
@@ -32,7 +32,7 @@ class PlotManager:
plot_cumulative_normalized
:
bool
=
False
,
plot_style
:
_styleT
=
'
fast
'
,
plot_update_mode
:
str
=
'
never
'
,
plot_dB_scale
:
bool
=
False
,
prop_cycle
=
None
,
raw_unit
:
str
=
'
V
'
,
processed_unit
:
Optional
[
str
]
=
None
,
uses_windowed_estimator
:
bool
=
True
,
complex_data
:
bool
=
False
,
uses_windowed_estimator
:
bool
=
True
,
complex_data
:
Optional
[
bool
]
=
False
,
figure_kw
:
Optional
[
Mapping
]
=
None
,
subplot_kw
:
Optional
[
Mapping
]
=
None
,
gridspec_kw
:
Optional
[
Mapping
]
=
None
,
legend_kw
:
Optional
[
Mapping
]
=
None
):
"""
A helper class that manages plotting spectrometer data.
"""
...
...
@@ -58,7 +58,7 @@ class PlotManager:
self
.
prop_cycle
=
prop_cycle
or
plt
.
rcParams
[
'
axes.prop_cycle
'
]
self
.
raw_unit
=
raw_unit
self
.
uses_windowed_estimator
=
uses_windowed_estimator
self
.
complex_data
=
complex_data
self
.
_
complex_data
=
complex_data
self
.
_leg
=
None
self
.
axes
=
{
key
:
dict
.
fromkeys
(
self
.
LINE_TYPES
)
for
key
in
self
.
PLOT_TYPES
}
...
...
@@ -323,6 +323,20 @@ class PlotManager:
if
'
fig
'
in
self
.
__dict__
:
self
.
setup_figure
()
@property
def
complex_data
(
self
)
->
bool
:
"""
Is there complex data resulting in negative frequencies in the FFT?
"""
if
self
.
_complex_data
is
not
None
:
return
self
.
_complex_data
complex_raw_data
=
any
(
np
.
iscomplexobj
(
d
[
'
timetrace_raw
'
])
for
d
in
self
.
_data
.
values
()
if
'
timetrace_raw
'
in
d
)
complex_processed_data
=
any
(
np
.
iscomplexobj
(
d
[
'
timetrace_processed
'
])
for
d
in
self
.
_data
.
values
()
if
'
timetrace_processed
'
in
d
)
return
complex_raw_data
or
complex_processed_data
def
main_plot
(
self
,
key
,
line_type
):
x
,
y
=
self
.
get_freq_data
(
key
,
line_type
,
self
.
plot_dB_scale
)
...
...
This diff is collapsed.
Click to expand it.
src/python_spectrometer/core.py
+
6
−
1
View file @
bf6197a6
...
...
@@ -411,8 +411,13 @@ class Spectrometer:
self
.
psd_estimator
=
partial
(
welch
,
**
psd_estimator
)
else
:
raise
TypeError
(
'
psd_estimator should be callable or kwarg dict for welch().
'
)
uses_windowed_estimator
=
'
window
'
in
inspect
.
signature
(
self
.
psd_estimator
).
parameters
if
self
.
daq
is
not
None
:
complex_data
=
np
.
issubdtype
(
self
.
daq
.
DTYPE
,
np
.
complexfloating
)
else
:
complex_data
=
None
self
.
_plot_manager
=
PlotManager
(
self
.
_data
,
plot_raw
,
plot_timetrace
,
plot_cumulative
,
plot_negative_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