You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am now using pySME to perform some abundance analysis, and I found that if I create two different SME_Struct() objects and perform LTE and NLTE spectrum synthesis, the flags in _smelib.GetNLTEflags() are always in the NLTE case so that if I run the LTE SME_Struct() again, the result will remain in NLTE even if the elements and grids in the LTE SME_Struct() are empty.
I am not sure if this is a bug or if I am not using pySME as designed. Now I import _smelib and run _smelib.ResetDepartureCoefficients() right before the SME_Struct() is created to make sure the flags are correct.
Here is the minimum code block which can recurrent this situation:
importmatplotlib.pyplotasplt# import pySMEfrompysme.smeimportSME_StructureasSME_Structfrompysme.abundimportAbundfrompysme.linelist.valdimportValdFilefrompysme.synthesizeimportsynthesize_spectrumfrompysme.smelibimport_smelibteff, logg=5000, 2.0vald=ValdFile("Li_vald")
plt.figure(figsize=(15,3), dpi=150)
sme_lte=SME_Struct()
# If the next line is commented, the result will be as Figure 1; if not, then Figure 2._smelib.ResetDepartureCoefficients()
sme_lte.teff, sme_lte.logg, sme_lte.monh=teff, logg, 0sme_lte.abund=Abund.solar()
sme_lte.linelist=valdsme_lte.wran= [[6706, 6710]]
sme_lte=synthesize_spectrum(sme_lte)
sme_nlte=SME_Struct()
_smelib.ResetDepartureCoefficients()
sme_nlte.teff, sme_nlte.logg, sme_nlte.monh=teff, logg, 0sme_nlte.abund=Abund.solar()
sme_nlte.linelist=valdsme_nlte.wran= [[6706, 6710]]
sme_nlte.nlte.set_nlte("Li", "marcs2012_Li.grd")
sme_nlte=synthesize_spectrum(sme_nlte)
plt.plot(sme_lte.wave[0], sme_lte.synth[0], label='LTE', alpha=0.5)
plt.plot(sme_nlte.wave[0], sme_nlte.synth[0], label='NLTE', alpha=0.5)
plt.axvline(6707.79)
plt.ylim(0.8, 1.02)
plt.xlim(6707, 6709)
plt.legend()
Figure 1: LTE and NLTE synthetic spectra are the same when ResetDepartureCoefficients is not executed
Figure 2: LTE and NLTE synthetic spectra are different when ResetDepartureCoefficients is executed
Best,
Mingjie
The text was updated successfully, but these errors were encountered:
Hi Ansgar,
I am now using pySME to perform some abundance analysis, and I found that if I create two different
SME_Struct()
objects and perform LTE and NLTE spectrum synthesis, the flags in _smelib.GetNLTEflags() are always in the NLTE case so that if I run the LTESME_Struct()
again, the result will remain in NLTE even if theelements
andgrids
in the LTESME_Struct()
are empty.I am not sure if this is a bug or if I am not using pySME as designed. Now I import _smelib and run
_smelib.ResetDepartureCoefficients()
right before theSME_Struct()
is created to make sure the flags are correct.Here is the minimum code block which can recurrent this situation:
Figure 1: LTE and NLTE synthetic spectra are the same when ResetDepartureCoefficients is not executed
Figure 2: LTE and NLTE synthetic spectra are different when ResetDepartureCoefficients is executed
Best,
Mingjie
The text was updated successfully, but these errors were encountered: