Skip to content

Commit

Permalink
Address Cookbook edits for release (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyschneck authored Jan 10, 2025
1 parent 4a747a5 commit 297ee3d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ Wavelets are a powerful tool to analyze time-series data. When data frequencies

This cookbook is broken into two main sections:

- Foundations
- Example Workflows
- Introduction
- Example Geoscience Workflows

### Foundations

_"Wavelet Basics"_ covers the motivation and background for wavelet analysis by reviewing time-series data and the strengths and weaknesses of other signal analysis tools like Fourier Transform

### Example Workflows
### Introduction

- _"Wavelet Basics"_: Understand the motivation and background for wavelet analysis by reviewing time-series data and the strengths and weaknesses of other signal analysis tools like Fourier Transform
- _"PyWavelets and Jingle Bells"_: Learn how to use `PyWavelets`, a Python implementation of wavelet analysis, to determine the order of notes in a simple musical piece
- _"Spy Keypad"_: Learn how to use wavelets to undercover the frequency and order of notes in an unknown piece of audio data
- _"Atmospheric Data: Nino 3 SST Index"_: Learn how to apply wavelets to real atmospheric and oceanic data to generate a power wavelet scalogram, similiar to the 1999 paper ["A Practical Guide to Wavelet Analysis"](https://psl.noaa.gov/people/gilbert.p.compo/Torrence_compo1998.pdf) by Torrence and Compo in Python

### Geoscience Workflows

- _"Atmospheric Data: Nino 3 SST Index"_: Learn how to apply wavelets to real atmospheric and oceanic data to generate a power wavelet scalogram, similar to the 1999 paper ["A Practical Guide to Wavelet Analysis"](https://psl.noaa.gov/people/gilbert.p.compo/Torrence_compo1998.pdf) by Torrence and Compo in Python

## Running the Notebooks

Expand All @@ -63,17 +63,15 @@ Jupyter](https://foundations.projectpythia.org/foundations/getting-started-jupyt

If you are interested in running this material locally on your computer, you will need to follow this workflow:

(Replace "cookbook-example" with the title of your cookbooks)

1. Clone the `https://github.com/ProjectPythia/cookbook-example` repository:
1. Clone the `https://github.com/ProjectPythia/wavelet-cookbook` repository:

```bash
git clone https://github.com/ProjectPythia/cookbook-example.git
git clone https://github.com/ProjectPythia/wavelet-cookbook.git
```

1. Move into the `cookbook-example` directory
1. Move into the `wavelet-cookbook` directory
```bash
cd cookbook-example
cd wavelet-cookbook
```
1. Create and activate your conda environment from the `environment.yml` file
```bash
Expand Down
6 changes: 3 additions & 3 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ parts:
- caption: Introduction
chapters:
- file: notebooks/wavelet-introduction/wavelet-basics
- caption: Example Workflows
- file: notebooks/wavelet-introduction/jingle-bells
- file: notebooks/wavelet-introduction/spy-keypad
- caption: Geoscience Workflows
chapters:
- file: notebooks/example-workflows/jingle-bells
- file: notebooks/example-workflows/spy-keypad
- file: notebooks/example-workflows/nino3
8 changes: 5 additions & 3 deletions notebooks/example-workflows/nino3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"wavelets = [f\"cmor{x:.1f}-{y:.1f}\" for x in [0.5, 1.5, 2.5] for y in [0.5, 1.0, 1.5]]\n",
"fig, axs = plt.subplots(3, 3, figsize=(10, 10), sharex=True, sharey=True)\n",
Expand Down Expand Up @@ -349,7 +351,7 @@
"metadata": {},
"source": [
"## Power Spectrum\n",
"The power spectrum is the real component of the wavelet coefficents. We can find this value by squaring the absolute value of the `wavelet_coeffs` to return the magnitude of the real component to make a better graph."
"The power spectrum is the real component of the wavelet coefficients. We can find this value by squaring the absolute value of the `wavelet_coeffs` to return the magnitude of the real component to make a better graph."
]
},
{
Expand Down Expand Up @@ -460,7 +462,7 @@
"metadata": {},
"source": [
"## Summary\n",
"Frequency signals appear in more than just audio! A frequency analysis of weather data can inform us about how weather trends change through a year and over a decades worth of data\n",
"Frequency signals appear in more than just audio! A frequency analysis of weather data can inform us about how weather trends change through a year and over a decades worth of data.\n",
"\n",
"### What's next?\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"source": [
"## PyWavelets Overview\n",
"\n",
"PyWavelets returns both the coefficents and frequency information for wavelets from the input data\n",
"PyWavelets returns both the coefficients and frequency information for wavelets from the input data\n",
"\n",
"```\n",
"coeffs, frequencies = pywt.cwt(data, scales, wavelet, sampling_period)\n",
Expand All @@ -124,10 +124,10 @@
"Required:\n",
"- data: input data (as an array)\n",
"- wavelet: name of the Mother wavelet\n",
"- scales: collection of the scales to use will determine the range which the wavelet will be streched or squished\n",
"- scales: collection of the scales to use will determine the range which the wavelet will be stretched or squished\n",
"\n",
"Optional:\n",
"- sampling_period: sampling period for frequencies output. Scales are not scaled by the period (and coefficents are independent of the sampling_period)"
"- sampling_period: sampling period for frequencies output. Scales are not scaled by the period (and coefficients are independent of the sampling_period)"
]
},
{
Expand All @@ -137,7 +137,7 @@
"### Return Values\n",
"The continuous wavelet transforms in PyWavelets returns two values:\n",
"\n",
"- coefficents: collection of complex number outputs for wavelet coefficients\n",
"- coefficients: collection of complex number outputs for wavelet coefficients\n",
"- frequencies: collection of frequencies (if the sampling period are in seconds then frequencies are in hertz otherwise a sampling period of 1 is assumed)\n",
"\n",
"The final size of coefficients depends on the length of the input data and the length of the given scales."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"source": [
"## Wavelet Analysis: Power Spectrum\n",
"\n",
"The power spectrum plots the real component of the complex number returns from wavelet coefficents. This will return information about the frequency and time that we need to use to determine which notes are used in what order for the keypad.\n",
"The power spectrum plots the real component of the complex number returns from wavelet coefficients. This will return information about the frequency and time that we need to use to determine which notes are used in what order for the keypad.\n",
"\n",
"For the purpose of this example, we will use the Morlet mother wavelet. Morlet is one type of mother wavelet useful for working with audio signals and is a good general wavelet to start with when analyzing frequencies of a signal.\n",
"\n",
Expand Down

0 comments on commit 297ee3d

Please sign in to comment.