Skip to content
Glenn Thompson edited this page May 26, 2016 · 7 revisions

GISMO is an object-oriented toolbox for Seismology. What does that mean?

Built-in data types

Programming languages like MATLAB, C, Fortran, Python etc. include built-in data types, e.g.

Simple data types:

  • boolean variables (true or false)
  • integers (1,2,3,...)
  • floating-point numbers (e.g. 3.141592653589793, 2.718281828459046, ...)
  • strings ('hello world')

Compound data types (MATLAB):

  • numeric arrays, e.g. a = [1 2 3 4 5], s = [0.1 0.2 0.3]
  • cell arrays, e.g. names = {'armando'; 'wilfried'; 'virginia'}
  • structures, e.g.
    • s = struct()
    • s.a = [1 2 3 4 5]
    • s.names = {'armando'; 'wilfried'; 'virginia'}

Classes

Classes are user-defined data types. But in seismology the data types we want to define are to describe:

  • waveform data
  • earthquake catalogs
  • networks (where stations are, deployment dates, instrument responses, etc.)

In a programming language when you say:

a = 5;

that's like saying

a = Integer(5)

Integer would be a class. a is the object - a variable of class (or data type) Integer.

With GISMO a statement like:

w = waveform()

means "let variable w (an object) be of data type (class) waveform".

Methods

Integers and floating point numbers have certain allowed operations, e.g:

a = 5;
b = 1.5;
c = a + b
d = a - b
e = a * b
f = a / b

Similarly, you can give user-defined data types (classes) certain allowed operations, e.g.

w = waveform(...)
detrend(w) - detrend a waveform object
plot(w)    - plot a waveform object

These allowed operations are called methods in object-oriented terminology.

Clone this wiki locally