Skip to content

Commit

Permalink
added correct data and path
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi0395 committed Jul 27, 2024
1 parent ed323d5 commit d1bc7a5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/test_convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

class TestQSOAbsFind(unittest.TestCase):

def setUp(self):
# Set the file path to the data file
self.fits_file = os.path.join(os.path.dirname(__file__), '..', 'data', 'qso_test.fits')
# Ensure the file exists
self.assertTrue(os.path.exists(self.fits_file), f"File {self.fits_file} does not exist")

def test_convolution_method_absorber_finder_in_QSO_spectra(self):
# Set up the input parameters for the function
fits_file = 'data/qso_test.fits'
# Check if the file exists
assert os.path.exists(fits_file), f"File {fits_file} does not exist"
spec_index = np.random.randint(100)
absorber = 'MgII'
ker_width_pix = [3, 4, 5, 6, 7, 8]
Expand All @@ -24,7 +27,7 @@ def test_convolution_method_absorber_finder_in_QSO_spectra(self):

# Call the function
result = convolution_method_absorber_finder_in_QSO_spectra(
fits_file, spec_index, absorber, ker_width_pix, coeff_sigma,
self.fits_file, spec_index, absorber, ker_width_pix, coeff_sigma,
mult_resi, d_pix, pm_pixel, sn_line1, sn_line2, use_covariance)

# Validate the output
Expand All @@ -33,8 +36,7 @@ def test_convolution_method_absorber_finder_in_QSO_spectra(self):

def test_parallel_convolution_method_absorber_finder_QSO_spectra(self):
# Set up the input parameters for the function
fits_file = 'qso_test.fits'
spec_indices = np.random.randint(0,100, size=3)
spec_indices = np.random.randint(0, 100, size=3)
absorber = 'MgII'
ker_width_pix = [3, 4, 5, 6, 7, 8]
coeff_sigma = 2.5
Expand All @@ -48,10 +50,9 @@ def test_parallel_convolution_method_absorber_finder_QSO_spectra(self):

# Call the function
results = parallel_convolution_method_absorber_finder_QSO_spectra(
fits_file, spec_indices, absorber, ker_width_pix, coeff_sigma,
self.fits_file, spec_indices, absorber, ker_width_pix, coeff_sigma,
mult_resi, d_pix, pm_pixel, sn_line1, sn_line2, use_covariance, n_jobs)

print("Results:", results)
# Validate the output
self.assertIsInstance(results, dict)
self.assertIn('index_spec', results)
Expand Down

0 comments on commit d1bc7a5

Please sign in to comment.