Skip to content

Commit

Permalink
Refs #40 fix syntax flukes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmborr committed Apr 10, 2018
1 parent 42dd823 commit c358a4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion qef/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from scipy import constants

planck_constant = constants.Planck / constants.e * 1E15 # meV*psec
hbar = planck_constant / (2 * np.pi) # meV*psec
hbar = planck_constant / (2 * np.pi) # meV*psec
9 changes: 3 additions & 6 deletions tests/integration/test_water.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
from qef.constants import hbar # units of meV x ps or ueV x ns
from qef.io.loaders import load_nexus
from qef.models.deltadirac import DeltaDiracModel
from qef.models.tabulatedmodel import TabulatedModel
from qef.models.resolution import TabulatedResolutionModel
from qef.models.teixeira import TeixeiraWaterModel
from qef.operators.convolve import Convolve


Expand Down Expand Up @@ -58,7 +56,7 @@ def generate_model_and_params(spectrum_index=None):
# Putting it all together
model = intensity * Convolve(resolution,
elastic + inelastic) + background
parameters = model.make_params() # model parameters are a separate entity.
parameters = model.make_params() # model params are a separate entity

# Ties and constraints
parameters['e_' + sp + 'amplitude'].set(min=0.0, max=1.0)
Expand Down Expand Up @@ -103,6 +101,7 @@ def generate_model_and_params(spectrum_index=None):

# Fit HWHM(Q^2) with Teixeira model
hwhms = 0.5 * np.asarray([fit.params['l_fwhm'].value for fit in fits])

def teixeira(q2s, difcoef, tau):
dq2 = difcoef * q2s
return hbar * dq2 / (1 + dq2 * tau)
Expand All @@ -117,7 +116,7 @@ def teixeira(q2s, difcoef, tau):
teixeira_fit.best_values['tau']],
[0.16, 1.11], decimal=2)

#Model for Simultaneous Fit of All Spectra with Teixeira Water Model
# Model for Simultaneous Fit of All Spectra with Teixeira Water Model
#
# create one model for each spectrum, but collect all parameters under
# a single instance of the Parameters class.
Expand Down Expand Up @@ -169,7 +168,5 @@ def residuals(params):
assert_almost_equal(g_fit.redchi, 0.93, decimal=2)




if __name__ == '__main__':
pytest.main([os.path.abspath(__file__)])

0 comments on commit c358a4c

Please sign in to comment.