def from_csv(self): filename = askopenfilename(initialdir=self.data_folder, title="CSV Sinogram", filetypes=(("CSV Files", "*.csv"), ("all files", "*.*"))) self.sinogram = sinogram.from_csv(filename) self.update('from_csv')
def test_to_unshuff_pdf(): result = sinogram.from_csv(SIN_CSV_FILE) f = os.path.join(DATA_PATH, result.meta['document_id'] + ' Sinogram.pdf') if os.path.isfile(f): os.remove(f) sinogram.to_unshuff_pdf(result, file_name=f) assert os.path.isfile(f)
def test_csv_to_png(): sinogram.to_png(sinogram.from_csv(SIN_CSV_FILE), PNG_CSV_FILE) assert os.path.isfile(PNG_CSV_FILE)
def test_from_csv(): result = sinogram.from_csv(SIN_CSV_FILE) assert result.meta['document_id'] == '00000 - ANONYMOUS, PATIENT' assert result.shape == (464, 64) assert np.all(result.data <= 1.0) assert np.all(result.data >= 0.0)
def test_get_mod_factor(): result = sinogram.from_csv(SIN_CSV_FILE) assert np.isclose(sinogram.get_mod_factor(result), 2.762391)
def test_get_histogram(): result = sinogram.from_csv(SIN_CSV_FILE) assert sinogram.get_histogram(result, bins=50)[0][0] == 25894