# Path: telluride_decoding/csv_util.py
# def write_results(file_name, regularization_list, all_results):
# def _read_results(file_name, skip_header=False):
# def read_all_results_from_directory(dir_name, skip_header=False, pattern=''):
# def plot_csv_results(test_name,
#                      results,
#                      golden_mean_std_dict=None,
#                      png_file_name=None,
#                      show_plot=False):
# 
# Path: telluride_decoding/plot_util.py
# def matplotlib_pyplot():
# def plot_mean_std(test_name,
#                   regularization_list,
#                   run_mean,
#                   run_std,
#                   golden_mean_std_dict=None,
#                   png_file_name=None,
#                   show_plot=False):


import collections
import os
import mock
import numpy as np
from absl import flags
from absl.testing import absltest
from telluride_decoding import csv_util
from telluride_decoding import plot_util
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

# Lint as: python2 python3




class CsvUtilTest(absltest.TestCase):

  def setUp(self):
    super(CsvUtilTest, self).setUp()
    self._test_data_dir = os.path.join(
        flags.FLAGS.test_srcdir, '__main__',
        'test_data/')

  def test_write_results(self):
    temp_dir = self.create_tempdir().full_path
    csv_file_name = os.path.join(temp_dir, 'x/y', 'test.csv')
    regularization_list = [1e-6, 1e-3, 1]
    all_results = np.array([[1.1, 1.2, 2.3, 2.4],
                            [3.5, 3.6, 4.7, 4.8],
                            [5.9, 5.1, 6.2, 6.3]])

    csv_util.write_results(csv_file_name, regularization_list, all_results)


# Path: telluride_decoding/csv_util.py
# def write_results(file_name, regularization_list, all_results):
# def _read_results(file_name, skip_header=False):
# def read_all_results_from_directory(dir_name, skip_header=False, pattern=''):
# def plot_csv_results(test_name,
#                      results,
#                      golden_mean_std_dict=None,
#                      png_file_name=None,
#                      show_plot=False):
# 
# Path: telluride_decoding/plot_util.py
# def matplotlib_pyplot():
# def plot_mean_std(test_name,
#                   regularization_list,
#                   run_mean,
#                   run_std,
#                   golden_mean_std_dict=None,
#                   png_file_name=None,
#                   show_plot=False):


# Path: test/csv_util_test.py
import collections
import os
import mock
import numpy as np
from absl import flags
from absl.testing import absltest
from telluride_decoding import csv_util
from telluride_decoding import plot_util

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

# Lint as: python2 python3




class CsvUtilTest(absltest.TestCase):

  def setUp(self):
    super(CsvUtilTest, self).setUp()
    self._test_data_dir = os.path.join(
        flags.FLAGS.test_srcdir, '__main__',
        'test_data/')

  def test_write_results(self):
    temp_dir = self.create_tempdir().full_path
    csv_file_name = os.path.join(temp_dir, 'x/y', 'test.csv')
    regularization_list = [1e-6, 1e-3, 1]
    all_results = np.array([[1.1, 1.2, 2.3, 2.4],
                            [3.5, 3.6, 4.7, 4.8],
                            [5.9, 5.1, 6.2, 6.3]])

    csv_util.write_results(csv_file_name, regularization_list, all_results)


    expected_content = """\