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

import os
import numpy as np
from unittest import TestCase
from core.feature_extraction.galaxy.galaxy_processor import GalaxyProcessor
from commons.helpers.dataset.strategies.galaxy_dataset.label_strategy import GalaxyDataSetLabelStrategy
from commons.helpers.dataset.context import Context

class TestGalaxyProcessor(TestCase):
    def setUp(self):

        validation_size = 0.2
        # Get the ground truth CSV file from script's parameters.
        self.galaxy_csv_file = os.environ["VIRTUAL_ENV"] + "/data/csv/galaxy/galaxy.csv"
        self.galaxy_images_path = os.environ["VIRTUAL_ENV"] + "/data/images/"

        # Create instance of data set loading strategies.
        galaxy_label_data_set_strategy = GalaxyDataSetLabelStrategy()

        # Set the context to galaxy label data set loading strategy.
        context = Context(galaxy_label_data_set_strategy)
        context.set_strategy(galaxy_label_data_set_strategy)
        self.label_dataset = context.load_dataset(csv_file=self.galaxy_csv_file, one_hot=False,
                                             validation_size=np.float32(validation_size))

    def testGalaxyProcessor(self):

        # Process galaxies.
        galaxy_processor = GalaxyProcessor(self.galaxy_images_path)
        #features = galaxy_processor.process_galaxy(self.label_dataset)
[((20, 41, 20, 69), 'commons.helpers.dataset.strategies.galaxy_dataset.label_strategy.GalaxyDataSetLabelStrategy', 'GalaxyDataSetLabelStrategy', ({}, {}), '()', False, 'from commons.helpers.dataset.strategies.galaxy_dataset.label_strategy import GalaxyDataSetLabelStrategy\n'), ((23, 18, 23, 57), 'commons.helpers.dataset.context.Context', 'Context', ({(23, 26, 23, 56): 'galaxy_label_data_set_strategy'}, {}), '(galaxy_label_data_set_strategy)', False, 'from commons.helpers.dataset.context import Context\n'), ((31, 27, 31, 67), 'core.feature_extraction.galaxy.galaxy_processor.GalaxyProcessor', 'GalaxyProcessor', ({(31, 43, 31, 66): 'self.galaxy_images_path'}, {}), '(self.galaxy_images_path)', False, 'from core.feature_extraction.galaxy.galaxy_processor import GalaxyProcessor\n'), ((26, 61, 26, 88), 'numpy.float32', 'np.float32', ({(26, 72, 26, 87): 'validation_size'}, {}), '(validation_size)', True, 'import numpy as np\n')]