<commit_before>#!/usr/bin/env python

"""
rsf

This module provides rate and state frictional modeling capability.

Documentation is provided throughout the module in the form of docstrings.
It is easy to view these in the iPython interactive shell environment. Simply
type the command and ? to view the docstring. Examples are provided at the
GitHub page (https://github.com/jrleeman/rate-and-state) in the README.md file.
"""

__authors__ = ["<NAME>", "<NAME>"]
__credits__ = ["<NAME>", "<NAME>"]
__license__ = ""
__version__ = "1.0."
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"

import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
from math import exp, log
from collections import namedtuple


class StateRelation(object):
    def __init__(self, relation):
        self.b = None
        self.Dc = None
        self.state = None

    def velocity_componet(self, system):
        return self.b * log(system.vref * self.state / self.Dc)


class DieterichState(StateRelation):
    def _set_steady_state(self, system):
        self.state = self.Dc/system.vref

    def evolve_state(self, system):
        if self.state is None:
            self.state = _steady_state(self, system)
        # return dtheta/dt
        dtheta_dt = 1. - system.v * self.state / self.Dc
        return dtheta_dt<commit_msg>Add Ruina and PRZ state realtions back into code<commit_after>#!/usr/bin/env python

"""
rsf

This module provides rate and state frictional modeling capability.

Documentation is provided throughout the module in the form of docstrings.
It is easy to view these in the iPython interactive shell environment. Simply
type the command and ? to view the docstring. Examples are provided at the
GitHub page (https://github.com/jrleeman/rate-and-state) in the README.md file.
"""

__authors__ = ["<NAME>", "<NAME>"]
__credits__ = ["<NAME>", "<NAME>"]
__license__ = ""
__version__ = "1.0."
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"

import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
from math import exp, log
from collections import namedtuple


class StateRelation(object):
    def __init__(self, relation):
        self.b = None
        self.Dc = None
        self.state = None

    def velocity_componet(self, system):
        return self.b * log(system.vref * self.state / self.Dc)


class DieterichState(StateRelation):
    def _set_steady_state(self, system):
        self.state = self.Dc/system.vref

    def evolve_state(self, system):
        if self.state is None:
            self.state = _steady_state(self, system)
        # return dtheta/dt
        return 1. - system.v * self.state / self.Dc


class RuinaState(StateRelation):
    def _set_steady_state(self, system):
        self.state = self.Dc/system.vref

    def evolve_state(self, system):
        if self.state is None:
            self.state = _steady_state(self, system)
        # return dtheta/dt
        return -1 * (system.v * self.state / self.Dc) * log(system.v * self.state / self.Dc)


class PrzState(StateRelation):
    def _set_steady_state(self, system):
        self.state = 2 * self.Dc / system.vref

    def evolve_state(self, system):
        if self.state is None:
            self.state = _steady_state(self, system)
        # return dtheta/dt
        return 1. - (system.v * self.state / (2 * self.Dc))**2
{'fraction_non_alphanumeric': 0.10413611029627456, 'fraction_numerical': 0.0032267527134056907, 'mean_word_length': 3.1034897713598073, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '25112', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1063, 'n_words': 333}