Usage
=====

Installation
------------

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

.. code-block:: console

                $ 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.

.. code-block:: python

   import earthquakepy as ep

Although the library can be imported as anything, we will use :code:`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.

.. py:function:: earthquakepy.read_peer_nga_file(filename)

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

   :param str filename: filename of the record file.
   :returns: TimeSeries object
   :rtype: earthquakepy.timeseries.Timeseries


.. py:function:: 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.

    :param str filename: filename of the raw data file.
    :param **kwargs: Optional arguments to be passed to numpy.genfromtxt
    :returns: TimeSeries object
    :rtype: earthquakepy.timeseries.TimeSeries


.. py:function:: 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.

    :param m: mass of the system.
    :param c: damping constant of the system.
    :param k: stiffness of the system.
    :param xi: damping ratio of the system.
    :param wn: natural frequency of the system.
    :param T: Period of the system.
    :type m: float or None
    :type c: float
    :type k: float or None
    :type xi: float
    :type wn: float or None
    :type T: float or None
    :returns: Sdof object
    :rtype: earthquakepy.singledof.Sdof


.. py:function:: earthquakepy.mdof(M=None, C=None, K=None)

    Creates a MDOF system object from the parameters provided.

    :param M: Mass matrix
    :param C: Damping matrix
    :param K: STiffness matrix
    :type M: 2-D array
    :type C: 2-D array
    :type K: 2-D array
    :returns: Mdof object
    :rtype: earthquakepy.multidof.Mdof


.. py:function:: earthquakepy.read_ops_json_model(filename)

    Reads a json model file generated by OpenSees using

    .. code-block:: tcl

        print -JSON -file filename

    :param str filename: json file filename
    :returns: OpenSeesModel object
    :rtype: earthquakepy.opensees_classes.OpenSeesModel


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

    Reads node output file generated by opensees node recorder command.

    :param str filename: Node output file name
    :param int ncomps: Number of components per node
    :param nodeTags: Optional, list of node tags to be used. Default: [1, 2, ...., n]
    :param compNames: Optional, list of component names. Default: ["0", "1", "2"]
    :type nodeTags: 1-D array or list
    :type compNames: 1-D array or list
    :returns: OpenSeesNodeOutput object
    :rtype: earthquakepy.opensees_helper.OpenSeesNodeOutput


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

    Reads node output file generated by opensees element recorder command.

    :param str filename: Element output file name
    :param int ncomps: Number of components per element
    :param elmTags: Optional, list of element tags to be used. Default: [1, 2, ...., n]
    :param compNames: Optional, list of component names. Default: ["0", "1", "2"]
    :type elmTags: 1-D array or list
    :type compNames: 1-D array or list
    :returns: OpenSeesNodeOutput object
    :rtype: earthquakepy.opensees_helper.OpenSeesNodeOutput
