<commit_before>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# This file has been created by ARSF Data Analysis Node and
# is licensed under the MIT Licence. A copy of this
# licence is available to download with this file.
#
# Author: <NAME>
# Created: 27/08/2015

from scipy.interpolate import interp1d
from scipy.integrate import trapz


class Spectra(object):
    """
    Class to store spectra
    and associated attributes

    * file_name - Name of file spectra was extracted from
    * wavelengths - Numpy array containing wavelengths
    * values - Numpy array containing value for each wavelength
    * pixel - Pixel (if spectra extracted from image)
    * line - Line (if spectra extracted from image)
    * latitude - Latitude of spectra (if available)
    * longitude - Longitude of spectra (if available)
    * wavelength_units - units of wavelengths (e.g., 'nm' or 'um')
    * value_type - type of values (typically reflectance)

    """
    def __init__(self):
        self.file_name = None
        self.wavelengths = None
        self.values = None
        self.pixel = None
        self.line = None
        self.latitude = None
        self.longitude = None
        self.wavelength_units = ""
        self.value_units = ""
        self.value_scaling = 1

    def plot(self, **kwargs):
        """Produces a basic plot of the spectrum

        Requires matplotlib to be installed

        """
        from matplotlib.pyplot import plot, xlabel, ylabel
        plot(self.wavelengths, self.values, label=self.file_name, **kwargs)
        xlabel("Wavelength (%s)" % self.wavelength_units)
        ylabel(self.value_units)<commit_msg>Added ability to specify label for plot<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# This file has been created by ARSF Data Analysis Node and
# is licensed under the MIT Licence. A copy of this
# licence is available to download with this file.
#
# Author: <NAME>
# Created: 27/08/2015

from scipy.interpolate import interp1d
from scipy.integrate import trapz


class Spectra(object):
    """
    Class to store spectra
    and associated attributes

    * file_name - Name of file spectra was extracted from
    * wavelengths - Numpy array containing wavelengths
    * values - Numpy array containing value for each wavelength
    * pixel - Pixel (if spectra extracted from image)
    * line - Line (if spectra extracted from image)
    * latitude - Latitude of spectra (if available)
    * longitude - Longitude of spectra (if available)
    * wavelength_units - units of wavelengths (e.g., 'nm' or 'um')
    * value_type - type of values (typically reflectance)

    """
    def __init__(self):
        self.file_name = None
        self.wavelengths = None
        self.values = None
        self.pixel = None
        self.line = None
        self.latitude = None
        self.longitude = None
        self.wavelength_units = ""
        self.value_units = ""
        self.value_scaling = 1

    def plot(self, label=None, **kwargs):
        """Produces a basic plot of the spectrum

        Requires matplotlib to be installed

        """
        from matplotlib.pyplot import plot, xlabel, ylabel

        if label is None:
            label = self.filename

        plot(self.wavelengths, self.values, label=label, **kwargs)
        xlabel("Wavelength (%s)" % self.wavelength_units)
        ylabel(self.value_units)
{'fraction_non_alphanumeric': 0.0861611094718206, 'fraction_numerical': 0.006491590439657716, 'mean_word_length': 2.5949098621421, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1331540', 'n_tokens_mistral': 991, 'n_tokens_neox': 937, 'n_words': 342}