Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tclements committed May 7, 2019
1 parent af1f8e1 commit 4d905b5
Show file tree
Hide file tree
Showing 16 changed files with 211 additions and 9 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov

# Files generated by invoking Julia with --track-allocation
*.jl.mem

# System-specific files and directories generated by the BinaryProvider and BinDeps packages
# They contain absolute paths specific to the host computer, and so should not be committed
deps/deps.jl
deps/build.log
deps/downloads/
deps/usr/
deps/src/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/

# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
29 changes: 29 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
push!(LOAD_PATH,"../src/")
using Documenter, Noise

makedocs(
modules = [Noise],
format = Documenter.HTML(),
sitename = "Noise.jl",
authors = "Tim Clements",
pages = Any[
"Home" => "index.md",
"Pre-Processing" => "preprocessing.md",
"Array Functions" => "arrayfuncs.md",
"Filters" => "filter.md",
"Computing FFTs" => "fft.md",
"Correlation" => "correlation.md",
"Types" => Any[
"InputParams" => "Types/inputparams.md",
"FFTData" => "Types/fftdata.md",
"CorrData" => "Types/corrdata.md",
],
],
)

deploydocs(
repo = "github.com/tclements/Noise.jl.git",
target = "build",
deps = nothing,
make = nothing,
)
5 changes: 5 additions & 0 deletions docs/src/Types/corrdata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
`CorrData` - Objects for ambient noise cross-correlations.

```@docs
CorrData
```
5 changes: 5 additions & 0 deletions docs/src/Types/fftdata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
`FFTData` - Objects for holding Fourier transforms (FFTs)

```@docs
FFTData
```
5 changes: 5 additions & 0 deletions docs/src/Types/inputparams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
`Input Parameters` - Objects for scheduling cross-correlations

```@docs
InputParams
```
6 changes: 6 additions & 0 deletions docs/src/arrayfuncs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# `Array Functions` - methods for operating on array-based noise and corelations.

```@docs
detrend!
demean!
```
10 changes: 10 additions & 0 deletions docs/src/correlation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# `Computing Correlations` - methods for computing correlations from FFTs.

```@docs
clean_up!
correlate
compute_cc
next_fast_len
save_corr
load_fft
```
7 changes: 7 additions & 0 deletions docs/src/fft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `Computing FFTs` - methods for computing FFTs raw noise data.

```@docs
whiten
process_fft
save_fft
```
8 changes: 8 additions & 0 deletions docs/src/filter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# `Filters` - methods for filtering `SeisData` and `SeisChannel` objects.

```@docs
bandpass!
bandstop!
lowpass!
highpass!
```
20 changes: 20 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Noise.jl

*Ambient Noise Cross-Correlation in Julia.*

Noise.jl provides routines for quickly and efficiently implementing [seismic interferometry](https://en.wikipedia.org/wiki/Seismic_interferometry).

## Package Features
- Built upon [SeisIO](https://seisio.readthedocs.io/en/latest/) for easy and fast I/O.
- Custom types for saving Fourier Transforms of data and cross-correlations
- Array-based processing of raw data and cross-correlation.
- Coming soon: methods for $dv/v$ and dispersion measurements.
- Coming soon: GPU support.

## Processing

## Plotting

## High-Performance Computing

## Tutorial
9 changes: 9 additions & 0 deletions docs/src/preprocessing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `Pre-Processing` - methods for cleaning raw noise data.

```@docs
process_raw!
downsample
slide
start_end
nearest_start_end
```
12 changes: 6 additions & 6 deletions src/ArrayFuncs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export detrend, detrend!, demean, demean!, bandpass, bandpass!, bandstop, bandstop!,
lowpass, lowpass!, highpass, highpass!
lowpass, lowpass!, highpass, highpass!
import Statistics.mean
import LinearAlgebra.pinv
using DSP
Expand All @@ -22,9 +22,9 @@ function lstsq(A::AbstractArray,X::AbstractArray)
end

"""
detrend!(A)
detrend!(X::AbstractArray{<:Union{Float32,Float64},1})
Remove linear trend from array `A` using least-squares regression.
Remove linear trend from array `X` using least-squares regression.
"""
function detrend!(X::AbstractArray{<:Union{Float32,Float64},1})
N = length(X)
Expand All @@ -38,7 +38,7 @@ detrend(A::AbstractArray{<:Union{Float32,Float64},1}) = (U = deepcopy(A);
detrend!(U);return U)

"""
detrend!(A)
detrend!(X::AbstractArray{<:Union{Float32,Float64},2})
Remove linear trend from columns of `X` using least-squares regression.
"""
Expand All @@ -56,7 +56,7 @@ detrend(A::AbstractArray{<:Union{Float32,Float64},2}) = (U = deepcopy(A);
detrend!(U);return U)

"""
demean!(A)
demean!(A::AbstractArray{<:Union{Float32,Float64},1})
Remove mean from array `A`.
"""
Expand All @@ -71,7 +71,7 @@ demean(A::AbstractArray{<:Union{Float32,Float64},1}) = (U = deepcopy(A);
demean!(U);return U)

"""
demean!(A)
demean!(A::AbstractArray{<:Union{Float32,Float64},2})
Remove mean from columns of array `A`.
"""
Expand Down
28 changes: 27 additions & 1 deletion src/Types/CorrData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,33 @@ const corrfields = [:id, :name, :loc, :comp, :rotated, :corr_type, :fs, :gain,
:freqmin, :freqmax, :cc_step, :whitened, :time_norm, :resp,
:notes, :misc, :maxlag, :t, :corr]

# This is type-stable for C = CorrData() but not for keyword args
"""
CorrData
A structure for cross-correlations of ambient noise data.
## Fields: CorrData
| **Field** | **Description** |
|:------------|:-------------|
| :name | Freeform channel names |
| :id | Channel ids. use NET.STA.LOC.CHAN format when possible. |
| :loc | Location (position) vector; freeform. |
| :fs | Sampling frequency in Hz. |
| :gain | Scalar gain; divide data by the gain to convert to units |
| :freqmin | Minimum frequency for whitening. |
| :freqmax | Maximum frequency for whitening. |
| :cc_len | Length of each correlation in seconds. |
| :cc_step | Spacing between correlation windows in seconds. |
| :whitened | Whitening applied.
| :time_norm | Apply one-bit whitening with "one_bit". |
| :resp | Instrument response; two-column matrix, format [zeros poles] |
| :misc | Dictionary for non-critical information. |
| :notes | Timestamped notes; includes automatically-logged acquisition and |
| | processing information. |
| :maxlag | Maximum lag time in seconds to keep from correlations. |
| :t | Starttime of each correlation. |
| :corr | Correlations stored in columns. |
"""
mutable struct CorrData
name::String # name [Net1.Sta1.Loc1.Chan1.Net2.Sta2.Loc2.Chan2]
id::String # id [Y-mm-dd] this is date of corr
Expand Down
28 changes: 27 additions & 1 deletion src/Types/FFTData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,33 @@ export FFTData
const fftfields = [:id, :name, :loc, :fs, :gain, :freqmin, :freqmax, :cc_step,
:whitened, :time_norm, :resp,:notes, :misc, :t, :fft]

# This is type-stable for F = FFTData() but not for keyword args
"""
FFTData
A structure for fourier transforms (FFT) of ambient noise data.
## Fields: FFTData
| **Field** | **Description** |
|:--------------------|:--------------------|
| :name | Freeform channel names |
| :id | Channel ids. use NET.STA.LOC.CHAN format when possible. |
| :loc | Location (position) vector; freeform. |
| :fs | Sampling frequency in Hz. |
| :gain | Scalar gain; divide data by the gain to convert to units |
| :freqmin | Minimum frequency for whitening. |
| :freqmax | Maximum frequency for whitening. |
| :cc_len | Length of each correlation in seconds. |
| :cc_step | Spacing between correlation windows in seconds. |
| :whitened | Whitening applied.
| :time_norm | Apply one-bit whitening with "one_bit". |
| :resp | Instrument response; two-column matrix, format [zeros poles] |
| :misc | Dictionary for non-critical information. |
| :notes | Timestamped notes; includes automatically-logged acquisition and |
| | processing information. |
| :maxlag | Maximum lag time in seconds to keep from correlations. |
| :t | Starttime of each FFT. |
| :fft | FFTs stored in columns. |
"""
mutable struct FFTData
name::String # name [Net.Sta.Loc.Chan]
id::String # id [Y-mm-dd] this is date of fft
Expand Down
22 changes: 22 additions & 0 deletions src/Types/InputParams.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
export InputParams

"""
InputParams
A structure for inputing parameters necessary for processing ambient noise data.
## Fields: InputParams
| **Field** | **Description** |
|:--------------------|:--------------------|
| :pair | Network.Station.Channel for each station to be correlated. |
| :FFTOUT | Directory filepath for FFT output. |
| :CORROUT | Directory filepath for correlation output. |
| :cc_len | Length of each correlation in seconds. |
| :cc_step | Spacing between correlation windows in seconds. |
| :fs | Sampling frequency in Hz to downsample raw data; set to 0.0. |
| :freqmin | Minimum frequency for whitening. |
| :freqmax | Maximum frequency for whitening. |
| :time_norm | Apply one-bit whitening with "one_bit". |
| :to_whiten | Apply whitening to FFTs. |
| :maxlag | Maximum lag time in seconds to keep from correlations. |
| :smoothing_half_win | Half window in samples for FFT smoothing. |
| :corr_type | Type of correlation e.g. "cross-correlate", "deconv" or "coherence" |
"""
mutable struct InputParams
pair::Array{String,1}
FFTOUT::String
Expand Down
2 changes: 1 addition & 1 deletion src/downsample.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function downsample(C::SeisChannel,fs::Float64)
end

"""
downsample(S::SeisData)
downsample(S::SeisData, fs::Float64)
Downsample SeisData sampling rate to frequency `fs`.
"""
Expand Down

0 comments on commit 4d905b5

Please sign in to comment.