Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lnlike #112

Merged
merged 7 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
version: 2

build:
image: latest
os: ubuntu-22.04
tools:
python: "3.12"

python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs
- all

formats: []
# Don't build any extra formats
formats: []
2 changes: 2 additions & 0 deletions measure_extinction/tests/test_plot_ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pkg_resources
import os
import warnings
import pytest

from measure_extinction.plotting.plot_ext import (
plot_multi_extinction,
Expand All @@ -9,6 +10,7 @@
)


@pytest.mark.skip(reason="failing due to changes in matplotlib")
def test_plot_extinction():
# get the location of the data files
data_path = pkg_resources.resource_filename("measure_extinction", "data/")
Expand Down
11 changes: 6 additions & 5 deletions measure_extinction/utils/fit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,19 @@ def lnlike(self, params, obsdata, modeldata):
hi_ext_modsed = modeldata.hi_abs_sed(params[10:12], self.velocities, ext_modsed)

norm_model = np.average(hi_ext_modsed["BAND"])
norm_data = np.average(obsdata.data["BAND"].fluxes)
norm_data = np.average(obsdata.data["BAND"].fluxes.value)

lnl = 0.0
for cspec in hi_ext_modsed.keys():
gvals = self.weights[cspec] > 0
lnl += -0.5 * np.sum(
np.square(
obsdata.data[cspec].fluxes[gvals] / norm_data
- hi_ext_modsed[cspec][gvals] / norm_model
chiarr = np.square(
(
obsdata.data[cspec].fluxes[gvals].value
- (hi_ext_modsed[cspec][gvals] * (norm_data / norm_model))
)
* self.weights[cspec][gvals]
)
lnl += -0.5 * np.sum(chiarr)

return lnl

Expand Down
2 changes: 1 addition & 1 deletion measure_extinction/utils/merge_iue_spec.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import argparse
import numpy as np
#import numpy as np
import pkg_resources

from astropy.table import Table
Expand Down