def return_GRB(self): """ Creates a new GRB object with only bins and rates. """ return EmptyGRB(self.bin_left, self.bin_right, self.counts, **self.kwargs)
def test_counts_shape(self): counts = np.ones((4,10)) with self.assertRaises(AssertionError): EmptyGRB(bin_left = self.bin_left, bin_right = self.bin_right, counts = counts)
import numpy as np from PyGRB.preprocess.grb import EmptyGRB GRB_discsc = EmptyGRB(bin_left=np.arange(100) * 0.064, bin_right=np.arange(100) * 0.064 + 0.064, counts=np.ones((100, 1)), burst=1, colours=['g'], clabels=['1'], datatype='discsc', satellite='test', simulated=True) GRB_tte = EmptyGRB(bin_left=np.arange(100) * 0.064, bin_right=np.arange(100) * 0.005 + 0.005, counts=np.ones((100, 1)), burst=1, colours=['g'], clabels=['1'], datatype='tte', satellite='test', simulated=True)
def test_assert_type_error_bin_right(self): bin_right = 2j with self.assertRaises(ValueError): EmptyGRB(bin_left = self.bin_left, bin_right = bin_right, counts = self.counts)
def test_assert_type_error_counts(self): counts = ['peanut'] with self.assertRaises(ValueError): EmptyGRB(bin_left = self.bin_left, bin_right = self.bin_right, counts = counts)
def test_counts_assignment(self): test = EmptyGRB(bin_left = self.bin_left, bin_right = self.bin_right, counts = self.counts) self.assertTrue(np.array_equal(self.counts, test.counts))
def test_burst_assignment(self): test = EmptyGRB(bin_left = self.bin_left, bin_right = self.bin_right, counts = self.counts)
def test_bin_cross_over(self): bin_left = np.arange(10) - 0.1 with self.assertRaises(AssertionError): EmptyGRB(bin_left = bin_left, bin_right = self.bin_right, counts = self.counts)
def test_unequal_time_counts(self): counts = np.ones((9,4)) with self.assertRaises(AssertionError): EmptyGRB(bin_left = self.bin_left, bin_right = self.bin_right, counts = counts)
def test_unequal_time_bins(self): bin_left = np.arange(9) with self.assertRaises(AssertionError): EmptyGRB(bin_left = bin_left, bin_right = self.bin_right, counts = self.counts)