Skip to content

Spectrogram support - #82

Draft
NavigSB wants to merge 24 commits into
crotwell:devfrom
NavigSB:spectrogram-support
Draft

Spectrogram support#82
NavigSB wants to merge 24 commits into
crotwell:devfrom
NavigSB:spectrogram-support

Conversation

@NavigSB

@NavigSB NavigSB commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

So, I finally gave the ol' spectrogram a try! Thanks a bunch @bclswl0827 for the huge headstart with the spectrogram-js code! My implementation extends Seismograph to piggyback off of the time and configuration functionality to hopefully ensure consistent behavior for the present and future. If this is a bad idea Philip, let me know and we can figure out another way to do it.

TODO: Add a picture of Tutorial 2 with a spectrogram

Scope

What's changed:

  • Added the SpectrogramConfig class, extending SeismographConfig by adding some important configuration options
  • Added the Spectrogram class, inheriting functionality from Seismograph
    • Configurable FFT window function, nfft, window size, color scale, overlap, frequency range, frequency axis label format function, and power values to define the color scaling
    • Has 11 different color scale options
    • Utilizes an image cache to allow for more efficient processing
    • Overrides drawSeismograms for custom spectrogram output
    • Overrides createLeftRightAxis for the right y-axis scale
    • Overrides createUnitsLabel to output "Hz" as the axis unit if ySublabelIsUnits is true
    • Overrides seisDataUpdated to clear the image cache when data is updated

Potential Risks / Drawbacks

  • There may be some side effects of extending Seismograph that weren't intended. The hope was that these features have been wholly overridden so that they exist but no longer function, but I may have missed some things.

Tested Scenarios

  • Tested on Tutorial 2, adding a spectrogram alongside the seismographs and aligning the time scales. Everything works as intended.

Review Notes / Questions

  • Interested in thoughts on this implementation strategy

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

TODO: Whoops, forgot to add tests. Need to make some before this is ready

NavigSB added 24 commits August 7, 2026 16:05
…, stop trimming in drawSeismograms for better math
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.

1 participant