<commit_before>import numpy as np
from scipy import interpolate
from mosfit.modules.engines.engine import Engine
from math import isnan

CLASS_NAME = 'CSM'

class CSM(Engine):
    """Magnetar spin-down engine

        input luminosity calculation from http://adsabs.harvard.edu/abs/2012ApJ...746..121C
        with coefficients from http://adsabs.harvard.edu/abs/1982ApJ...258..790C

    """


    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def process(self, **kwargs):
        self._s = kwargs['s'] #preset in the model name for now
        self._delta = kwargs['delta'] # [0,3)
        self._n = kwargs['n'] # [6,10]
        self._kappa = kwargs['kappa']
        self._R0 = kwargs['r0'] * 1.496e13 #AU to cm
        self._mejecta = kwargs['mejecta'] * 1.9884e33#Msol to grms
        self._mnickel = kwargs['mejecta'] * kwargs['fnickel']
        self._mcsm = kwargs['mcsm'] * 1.9884e33
        self._rho = 10.**(kwargs['rho'])
        self._vph = kwargs['vejecta'] * 1.e5
        self._Esn = 3. * self._vph**2 / 10. * self._mejecta
        self._texplosion = kwargs['texplosion']


        c = 3.0e10

        if 'densetimes' in kwargs:
            self._times = kwargs['densetimes']
        else:<commit_msg>adding updated csm engine<commit_after>import numpy as np
from scipy import interpolate
from mosfit.modules.engines.engine import Engine
from math import isnan

CLASS_NAME = 'CSM'

class CSM(Engine):
    """Magnetar spin-down engine

        input luminosity calculation from http://adsabs.harvard.edu/abs/2012ApJ...746..121C
        with coefficients from http://adsabs.harvard.edu/abs/1982ApJ...258..790C

    """


    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def process(self, **kwargs):
        self._s = kwargs['s'] #preset in the model name for now
        self._delta = kwargs['delta'] # [0,3)
        self._n = kwargs['n'] # [6,10]
        self._kappa = kwargs['kappa']
        self._R0 = kwargs['r0'] * 1.496e13 #AU to cm
        self._mejecta = kwargs['mejecta'] * 1.9884e33#Msol to grms
        self._mcsm = kwargs['mcsm'] * 1.9884e33
        self._rho = kwargs['rho']
        self._vph = kwargs['vejecta'] * 1.e5
        self._Esn = 3. * self._vph**2 / 10. * self._mejecta
        self._texplosion = kwargs['texplosion']


        c = 3.0e10

        if 'densetimes' in kwargs:
            self._times = kwargs['densetimes']
        else:
{'fraction_non_alphanumeric': 0.14232519652461728, 'fraction_numerical': 0.04799338022341746, 'mean_word_length': 2.4891774891774894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '750430', 'n_tokens_mistral': 893, 'n_tokens_neox': 815, 'n_words': 187}