# Path: astroNN/config.py
# MAGIC_NUMBER = magic_num_reader()
# 
# Path: astroNN/nn/numpy.py
# def sigmoid_inv(x):
#     """
#     NumPy implementation of tf.sigmoid inverse, mask ``magicnumber``
# 
#     :param x: Data to be applied inverse sigmoid activation
#     :type x: Union[numpy.ndarray, float]
#     :return: Inverse Sigmoid activated data
#     :rtype: Union[numpy.ndarray, float]
#     :History: 2018-Apr-11 - Written - Henry Leung (University of Toronto)
#     """
#     x = np.ma.array(x, mask=(x == MAGIC_NUMBER))
#     return np.ma.log(np.ma.divide(x, np.ma.subtract(1, x)))
# 
# def sigmoid(x):
#     """
#     NumPy implementation of tf.sigmoid, mask ``magicnumber``
# 
#     :param x: Data to be applied sigmoid activation
#     :type x: Union[ndarray, float]
#     :return: Sigmoid activated data
#     :rtype: Union[ndarray, float]
#     :History: 2018-Apr-11 - Written - Henry Leung (University of Toronto)
#     """
#     x = np.ma.array(x, mask=(x == MAGIC_NUMBER))
#     return np.ma.divide(1, np.ma.add(1, np.divide(1, np.ma.exp(x))))
# 
# Path: astroNN/shared/dict_tools.py
# def list_to_dict(names, arrs):
#     """
#     Matching a list of array with names
#     """
#     # TODO: need detailed test
#     if type(arrs) is list:
#         final_dict = {}
#         if len(names) == len(arrs):
#             for name, arr in zip(names, arrs):
#                 final_dict.update({name: arr})
#         elif len(arrs):
#             for name in names:
#                 final_dict.update({name: arrs[0]})
#         else:
#             raise IndexError(f"names has a length of {len(names)} but arrs has a  length of {len(arrs)}")
#         return final_dict
#     elif type(arrs) is np.ndarray and len(names) == 1:
#         return {names[0]: arrs}
#     elif type(arrs) is np.ndarray and len(names) > 1:
#         final_dict = {}
#         for name in names:
#             final_dict.update({name: arrs})
#         return final_dict
#     else:
#         return arrs
# 
# def to_iterable(var):
#     """
#     convert things to list
#     treat string as not iterable!
#     """
#     try:
#         if type(var) is str:
#             raise Exception
#         iter(var)
#     except Exception:
#         return [var]
#     else:
#         return var


import warnings
import numpy as np
from astroNN.config import MAGIC_NUMBER
from astroNN.nn.numpy import sigmoid_inv, sigmoid
from astroNN.shared.dict_tools import list_to_dict, to_iterable
            data_array = data_array.astype(np.float32, copy=False)  # need to convert data to float in every case

            if self.normalization_mode[name] == '0':
                self.featurewise_center.update({name: False})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: False})
                self.mean_labels.update({name: np.array([0.])})
                self.std_labels.update({name: np.array([1.])})
            elif self.normalization_mode[name] == '1':
                self.featurewise_center.update({name: False})
                self.datasetwise_center.update({name: True})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: True})
            elif self.normalization_mode[name] == '2':
                self.featurewise_center.update({name: True})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: True})
                self.datasetwise_stdalization.update({name: False})
            elif self.normalization_mode[name] == '3':
                self.featurewise_center.update({name: True})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: False})
            elif self.normalization_mode[name] == '3s':  # allow custom function, default to use sigmoid to normalize
                self.featurewise_center.update({name: False})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: False})
                if self._custom_norm_func is None:

# Path: astroNN/config.py
# MAGIC_NUMBER = magic_num_reader()
# 
# Path: astroNN/nn/numpy.py
# def sigmoid_inv(x):
#     """
#     NumPy implementation of tf.sigmoid inverse, mask ``magicnumber``
# 
#     :param x: Data to be applied inverse sigmoid activation
#     :type x: Union[numpy.ndarray, float]
#     :return: Inverse Sigmoid activated data
#     :rtype: Union[numpy.ndarray, float]
#     :History: 2018-Apr-11 - Written - Henry Leung (University of Toronto)
#     """
#     x = np.ma.array(x, mask=(x == MAGIC_NUMBER))
#     return np.ma.log(np.ma.divide(x, np.ma.subtract(1, x)))
# 
# def sigmoid(x):
#     """
#     NumPy implementation of tf.sigmoid, mask ``magicnumber``
# 
#     :param x: Data to be applied sigmoid activation
#     :type x: Union[ndarray, float]
#     :return: Sigmoid activated data
#     :rtype: Union[ndarray, float]
#     :History: 2018-Apr-11 - Written - Henry Leung (University of Toronto)
#     """
#     x = np.ma.array(x, mask=(x == MAGIC_NUMBER))
#     return np.ma.divide(1, np.ma.add(1, np.divide(1, np.ma.exp(x))))
# 
# Path: astroNN/shared/dict_tools.py
# def list_to_dict(names, arrs):
#     """
#     Matching a list of array with names
#     """
#     # TODO: need detailed test
#     if type(arrs) is list:
#         final_dict = {}
#         if len(names) == len(arrs):
#             for name, arr in zip(names, arrs):
#                 final_dict.update({name: arr})
#         elif len(arrs):
#             for name in names:
#                 final_dict.update({name: arrs[0]})
#         else:
#             raise IndexError(f"names has a length of {len(names)} but arrs has a  length of {len(arrs)}")
#         return final_dict
#     elif type(arrs) is np.ndarray and len(names) == 1:
#         return {names[0]: arrs}
#     elif type(arrs) is np.ndarray and len(names) > 1:
#         final_dict = {}
#         for name in names:
#             final_dict.update({name: arrs})
#         return final_dict
#     else:
#         return arrs
# 
# def to_iterable(var):
#     """
#     convert things to list
#     treat string as not iterable!
#     """
#     try:
#         if type(var) is str:
#             raise Exception
#         iter(var)
#     except Exception:
#         return [var]
#     else:
#         return var


# Path: astroNN/nn/utilities/normalizer.py
import warnings
import numpy as np
from astroNN.config import MAGIC_NUMBER
from astroNN.nn.numpy import sigmoid_inv, sigmoid
from astroNN.shared.dict_tools import list_to_dict, to_iterable

            data_array = data_array.astype(np.float32, copy=False)  # need to convert data to float in every case

            if self.normalization_mode[name] == '0':
                self.featurewise_center.update({name: False})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: False})
                self.mean_labels.update({name: np.array([0.])})
                self.std_labels.update({name: np.array([1.])})
            elif self.normalization_mode[name] == '1':
                self.featurewise_center.update({name: False})
                self.datasetwise_center.update({name: True})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: True})
            elif self.normalization_mode[name] == '2':
                self.featurewise_center.update({name: True})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: True})
                self.datasetwise_stdalization.update({name: False})
            elif self.normalization_mode[name] == '3':
                self.featurewise_center.update({name: True})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: False})
            elif self.normalization_mode[name] == '3s':  # allow custom function, default to use sigmoid to normalize
                self.featurewise_center.update({name: False})
                self.datasetwise_center.update({name: False})
                self.featurewise_stdalization.update({name: False})
                self.datasetwise_stdalization.update({name: False})
                if self._custom_norm_func is None:

                    self._custom_norm_func = sigmoid