Commit 8c8c5aca authored by Matteo.Guardiani's avatar Matteo.Guardiani
Browse files

andrija: Introduced age and logload as arrays instead of reading them from csv.

parent e9d6d784
......@@ -21,7 +21,6 @@ import nifty7 as ift
import numpy as np
from binner import bin_1D, bin_2D
from data_utilities import read_in
# define a new metaclass which overrides the "__call__" function
......@@ -33,7 +32,7 @@ class ClassLoader(type):
class Data(metaclass=ClassLoader):
def __init__(self, npix_age, npix_ll, ll_threshold, reshuffle_seed, csv_dataset_path):
def __init__(self, npix_age, npix_ll, ll_threshold, reshuffle_seed, age, ll):
if not isinstance(npix_age, int):
raise TypeError("Number of pixels argument needs to be of type int.")
......@@ -46,13 +45,19 @@ class Data(metaclass=ClassLoader):
if not isinstance(reshuffle_seed, int):
raise TypeError("Reshuffle iterator argument needs to be of type int.")
if not isinstance(csv_dataset_path, str):
raise TypeError("The dataset file path argument needs to be of type str.")
if not isinstance(age, np.ndarray):
raise TypeError("The age dataset argument needs to be of type np.ndarray.")
if not isinstance(ll, np.ndarray):
raise TypeError("The ll dataset argument needs to be of type np.ndarray.")
if not age.size == ll.size:
raise TypeError("The dataset has to contain pairs of age and log load data.")
self.npix_age, self.npix_ll = npix_age, npix_ll
self.ll_threshold = ll_threshold
self.reshuffle_seed = reshuffle_seed
self.csv_dataset_path = csv_dataset_path
self.age = age, self.ll = ll
self.age, self.ll = self.filter()
self.data = None
......@@ -65,7 +70,6 @@ class Data(metaclass=ClassLoader):
def filter(self):
# Loads, filters and reshuffles data
self.age, self.ll = read_in(self.csv_dataset_path)
self.ll, self.age = self.data_filter_x(self.ll_threshold, self.ll, self.age)
if not self.reshuffle_seed == 0:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment