Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cross spectrum plotting #763

Merged
merged 9 commits into from
Oct 6, 2023
Merged

Fix cross spectrum plotting #763

merged 9 commits into from
Oct 6, 2023

Conversation

matteobachetti
Copy link
Member

Eliminates the annoying "imaginary" curve in Powerspectrum and other derivates of Crossspectrum that don't have one. Also, fixes the labels

@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

Merging #763 (23ad8a5) into main (0f746f6) will increase coverage by 5.40%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #763      +/-   ##
==========================================
+ Coverage   90.74%   96.14%   +5.40%     
==========================================
  Files          43       43              
  Lines        7918     7937      +19     
==========================================
+ Hits         7185     7631     +446     
+ Misses        733      306     -427     
Files Coverage Δ
stingray/crossspectrum.py 99.04% <100.00%> (+0.03%) ⬆️

... and 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@mgullik mgullik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @matteobachetti,

this is useful.
One small thing, real and imaginary parts can have very different values, in that case one of the two quantities could be very difficult to read in the plot.
Have you thought of using
ax2 = ax.twinx()
ax2.plot(self.freq, self.power.imag, marker, color="g", alpha=0.5, label="Imaginary Part")
ax2.tick_params('y', colors="g")

and then

if labels is not None:
ax2.set_ylabel(labels[1])
else:
ax2.set_ylabel(f"Power ({self.norm})")

Or something on this line?

@matteobachetti matteobachetti force-pushed the fix_cross_spectrum_plotting branch from a096db4 to 320dd13 Compare October 5, 2023 14:10
@matteobachetti
Copy link
Member Author

pds

@matteobachetti matteobachetti force-pushed the fix_cross_spectrum_plotting branch from bb46275 to 34e1658 Compare October 5, 2023 15:25
@matteobachetti
Copy link
Member Author

@mgullik the failures are unrelated to this PR

@mgullik mgullik added this pull request to the merge queue Oct 6, 2023
Merged via the queue into main with commit 3fc3c15 Oct 6, 2023
15 checks passed
@matteobachetti matteobachetti deleted the fix_cross_spectrum_plotting branch October 6, 2023 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants