<commit_before>'''
Class for doing stuff with output from AccuRT.
'''

import os
import copy
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from scipy.ndimage.filters import gaussian_filter1d as gaussf
from .file_reading import read_irradiance, read_radiance, \
    read_material_profile, read_iops


class ReadART(object):
    '''Reads the output text files from AccuRT, and includes methods for
    calculating albedo and transmittance, and for simple plotting.

    Assumes that the number of detector depths and wavelengths
    does *not* change when using repeated runs.

    Positional argument:

    expname -- Name of the main config file.

    Keyword arguments:

    basefolder -- Folder where the main configfile is located.
        Default './'.

    cosine -- Boolean. If True (which is default), read in the
        total cosine irradiance.

    diffuse -- Boolean. If True, read in the diffuse cosine irradiance.
        Default False.

    direct -- Boolean. If True, read in the direct cosine irradiance.
        Default False.

    runvarfile -- Filename or list-like structure holding indices for repeated
        runs. Default None.

    scalar -- Boolean. If True, read in total scalar irradiance
        Default False.

    sine -- Boolean. If True, read in total sine weighted irradiance
        Default False.

    radiance -- Boolean. If True, read radiance.
        Default False.

    iops -- Boolean. If True, read iops-file into a dict.
        Default False.

    material_profile -- Boolean. If True, read material_profile-file.
        Default False.


     Example:
     >>> a = pyAccu('atmOcean')
     >>> transm = a.transmittance(layers=(2,4),integrated=True)
     >>> a.plot()
     >>> a.plot(profile=True)
     '''

    def __init__(self, expname, basefolder='./', cosine=True,
                 diffuse=False, direct=False,
                 runvarfile=None, scalar=False, iops=False,
                 radiance=False, sine=False, material_profile=False):
        '''See PyAccu for description of arguments.'''

        self.has_cosine = False
        self.has_diffuse = False
        self.has_direct = False
        self.has_scalar = False
        self.has_sine = False
        self.has_iops = False

        outputfolder = expname + 'Output'

        fn_fmt = '{0}_irradiance_{1}_{2}ward.txt'

        if cosine:
            self.has_cosine = True
            cos_u_file = fn_fmt.format('cosine', 'total', 'up')
            cos_d_file = fn_fmt.format('cosine', 'total', 'down')<commit_msg>Fixed example in docstring<commit_after>'''
Class for doing stuff with output from AccuRT.
'''

import os
import copy
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from scipy.ndimage.filters import gaussian_filter1d as gaussf
from .file_reading import read_irradiance, read_radiance, \
    read_material_profile, read_iops


class ReadART(object):
    '''Reads the output text files from AccuRT, and includes methods for
    calculating albedo and transmittance, and for simple plotting.

    Assumes that the number of detector depths and wavelengths
    does *not* change when using repeated runs.

    Positional argument:

    expname -- Name of the main config file.

    Keyword arguments:

    basefolder -- Folder where the main configfile is located.
        Default './'.

    cosine -- Boolean. If True (which is default), read in the
        total cosine irradiance.

    diffuse -- Boolean. If True, read in the diffuse cosine irradiance.
        Default False.

    direct -- Boolean. If True, read in the direct cosine irradiance.
        Default False.

    runvarfile -- Filename or list-like structure holding indices for repeated
        runs. Default None.

    scalar -- Boolean. If True, read in total scalar irradiance
        Default False.

    sine -- Boolean. If True, read in total sine weighted irradiance
        Default False.

    radiance -- Boolean. If True, read radiance.
        Default False.

    iops -- Boolean. If True, read iops-file into a dict.
        Default False.

    material_profile -- Boolean. If True, read material_profile-file.
        Default False.


     Example:
     >>> import accuread as ar
     >>> a = ar.ReadART('atmOcean')
     >>> transm = a.transmittance(layers=(2,4),integrated=True)
     >>> a.plot()
     >>> a.plot(profile=True)
     '''

    def __init__(self, expname, basefolder='./', cosine=True,
                 diffuse=False, direct=False,
                 runvarfile=None, scalar=False, iops=False,
                 radiance=False, sine=False, material_profile=False):
        '''See PyAccu for description of arguments.'''

        self.has_cosine = False
        self.has_diffuse = False
        self.has_direct = False
        self.has_scalar = False
        self.has_sine = False
        self.has_iops = False

        outputfolder = expname + 'Output'

        fn_fmt = '{0}_irradiance_{1}_{2}ward.txt'

        if cosine:
            self.has_cosine = True
            cos_u_file = fn_fmt.format('cosine', 'total', 'up')
            cos_d_file = fn_fmt.format('cosine', 'total', 'down')
{'fraction_non_alphanumeric': 0.08769887466045789, 'fraction_numerical': 0.002328288707799767, 'mean_word_length': 2.4667114996637527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 30, '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': '3472191', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1446, 'n_words': 504}