Usage — earthquakepy 0.1.0 documentation

# Usage

## Installation

earthquakepy can be installed using pip. It’s an absolute breeze. Try it!

    $ pip install earthquakepy

Thats it! This will install the earthquakepy and other required libraries. Wasn’t that easy?

## Import

Probably you know how to import the library. Let me just remind you.

    import earthquakepy as ep

Although the library can be imported as anything, we will use `ep` for the same.

## Core functions

Following are the functions available in the library. Do note that several other functions/modules exists in the library inside various classes and those are not included here.

earthquakepy.read_peer_nga_file(filename)

  Reads a PEER-NGA west2 database record from a file given by filename.

  Parameters

    filename (str) – filename of the record file.

  Returns

    TimeSeries object

  Return type

    earthquakepy.timeseries.Timeseries

earthquakepy.read_raw_file(filename, **kwargs)

  Reads the data from a raw file with first column as time axis and second column as ordinates. This function is a wrapper around numpy.genfromtxt and accepts all of its arguments.

  Parameters

    - filename (str) – filename of the raw data file.

    - **kwargs –

      Optional arguments to be passed to numpy.genfromtxt

  Returns

    TimeSeries object

  Return type

    earthquakepy.timeseries.TimeSeries

earthquakepy.sdof(m=None, c=0.0, k=None, xi=0.0, wn=None, T=None)

  Creates a SDOF system object from the parameters provided. User should provide the set of parameters appropriately.

  Parameters

    - m (float or None) – mass of the system.

    - c (float) – damping constant of the system.

    - k (float or None) – stiffness of the system.

    - xi (float) – damping ratio of the system.

    - wn (float or None) – natural frequency of the system.

    - T (float or None) – Period of the system.

  Returns

    Sdof object

  Return type

    earthquakepy.singledof.Sdof

earthquakepy.mdof(M=None, C=None, K=None)

  Creates a MDOF system object from the parameters provided.

  Parameters

    - M (2-D array) – Mass matrix

    - C (2-D array) – Damping matrix

    - K (2-D array) – STiffness matrix

  Returns

    Mdof object

  Return type

    earthquakepy.multidof.Mdof

earthquakepy.read_ops_json_model(filename)

  Reads a json model file generated by OpenSees using

      print -JSON -file filename

  Parameters

    filename (str) – json file filename

  Returns

    OpenSeesModel object

  Return type

    earthquakepy.opensees_classes.OpenSeesModel

earthquakepy.read_ops_node_output(filename, ncomps, [nodeTags=[], compNames=[], ]**kwargs)

  Reads node output file generated by opensees node recorder command.

  Parameters

    - filename (str) – Node output file name

    - ncomps (int) – Number of components per node

    - nodeTags (1-D array or list) – Optional, list of node tags to be used. Default: [1, 2, …., n]

    - compNames (1-D array or list) – Optional, list of component names. Default: [“0”, “1”, “2”]

  Returns

    OpenSeesNodeOutput object

  Return type

    earthquakepy.opensees_helper.OpenSeesNodeOutput

earthquakepy.read_ops_element_output(filename, ncomps, [nodeTags=[], compNames=[], ]**kwargs)

  Reads node output file generated by opensees element recorder command.

  Parameters

    - filename (str) – Element output file name

    - ncomps (int) – Number of components per element

    - elmTags (1-D array or list) – Optional, list of element tags to be used. Default: [1, 2, …., n]

    - compNames (1-D array or list) – Optional, list of component names. Default: [“0”, “1”, “2”]

  Returns

    OpenSeesNodeOutput object

  Return type

    earthquakepy.opensees_helper.OpenSeesNodeOutput