Skip to content

Add basic mathematical calculations utility module #4

Description

@rwtamCaltech

Summary

This issue tracks the addition of a basic mathematical calculations utility module (math_utils.py) to the repository.

Motivation

As the codebase grows with seismic processing scripts (PhaseNet, GaMMa), having a shared utility module for common mathematical operations will:

  • Reduce code duplication across scripts
  • Provide a consistent, tested set of math helpers
  • Make future scripts easier to write and maintain

Proposed Implementation

Create a new file math_utils.py at the root of the repository that provides the following functions:

  • add(a, b) — addition
  • subtract(a, b) — subtraction
  • multiply(a, b) — multiplication
  • divide(a, b) — division (with zero-division guard)
  • power(base, exp) — exponentiation
  • square_root(n) — square root (with negative-input guard)
  • mean(values) — arithmetic mean of a list
  • median(values) — median of a list

Acceptance Criteria

  • math_utils.py is created with all functions listed above
  • Each function includes a docstring
  • Division and square root guard against invalid inputs
  • Functions are importable from other scripts in the repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions