Skip to content

Commit

Permalink
arguments cleanup and plot_absorber() updated
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi0395 committed Aug 6, 2024
1 parent c86afb3 commit c0c3446
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion qsoabsfind/parallel_convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def main():
# Set the environment variable for the constants file
if args.constant_file:
print(f"INFO: Using user-provided constants from: {os.path.abspath(args.constant_file)}")
print(f'INFO: Overwriting QSO_CONSTANTS_FILE variable with this path')
print("INFO: Overwriting QSO_CONSTANTS_FILE variable with this path")
os.environ['QSO_CONSTANTS_FILE'] = os.path.abspath(args.constant_file)

print(f"INFO: QSO_CONSTANTS_FILE: {os.environ['QSO_CONSTANTS_FILE']}")
Expand Down
Binary file modified tests/__pycache__/test_convolution.cpython-39.pyc
Binary file not shown.
30 changes: 4 additions & 26 deletions tests/test_convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import numpy as np
from qsoabsfind.absfinder import read_single_spectrum_and_find_absorber
from qsoabsfind.parallel_convolution import parallel_convolution_method_absorber_finder_QSO_spectra
from qsoabsfind.config import load_constants
constants = load_constants()

class TestQSOAbsFind(unittest.TestCase):

Expand All @@ -16,22 +18,10 @@ def test_convolution_method_absorber_finder_in_QSO_spectra(self):
# Set up the input parameters for the function
spec_index = np.random.randint(100)
absorber = 'MgII'
ker_width_pixels = [3, 4, 5, 6, 7, 8]
coeff_sigma = 2.5
mult_resi = 1
d_pix = 0.6
pm_pixel = 200
sn_line1 = 3
sn_line2 = 2
use_covariance = False
logwave=True
verbose=False

kwargs = {'ker_width_pixels': ker_width_pixels, 'coeff_sigma': coeff_sigma, 'mult_resi': mult_resi, 'd_pix': d_pix, 'pm_pixel': pm_pixel, 'sn_line1': sn_line1, 'sn_line2': sn_line2, 'use_covariance': use_covariance, 'logwave': logwave, 'verbose': verbose}

# Call the function
result = read_single_spectrum_and_find_absorber(
self.fits_file, spec_index, absorber, **kwargs)
self.fits_file, spec_index, absorber, **constants.search_parameters[absorber])

# Validate the output
self.assertIsInstance(result, tuple)
Expand All @@ -41,22 +31,10 @@ def test_parallel_convolution_method_absorber_finder_QSO_spectra(self):
# Set up the input parameters for the function
spec_indices = np.random.randint(0, 100, size=3)
absorber = 'MgII'
ker_width_pixels = [3, 4, 5, 6, 7, 8]
coeff_sigma = 2.5
mult_resi = 1
d_pix = 0.6
pm_pixel = 200
sn_line1 = 3
sn_line2 = 2
use_covariance = False
n_jobs = 4
logwave=True
verbose=False

# Call the function
results = parallel_convolution_method_absorber_finder_QSO_spectra(
self.fits_file, spec_indices, absorber, ker_width_pixels, coeff_sigma,
mult_resi, d_pix, pm_pixel, sn_line1, sn_line2, use_covariance, logwave, verbose, n_jobs)
self.fits_file, spec_indices, absorber, n_jobs, **constants.search_parameters[absorber])

# Validate the output
self.assertIsInstance(results, dict)
Expand Down

0 comments on commit c0c3446

Please sign in to comment.