samuelyeewl / specmatch-emp

Empirical SpecMatch
9 stars 8 forks source link

[BUG] specmatch not storing results #20

Closed petigura closed 7 years ago

petigura commented 7 years ago

Hi, Samuel.

I'm trying to get SM to run on my machine. Perhaps I'm calling the wrapper routine incorrectly... The code finishes the matching an linear combination steps, but It looks like the sm.results dictionary is not getting correctly populated.

Erik

$ smemp specmatch ~/.cpsutils/mir3/iodfitsdb/rj201.587.fits -o test
Reading library from /Users/petigura/.specmatchemp/library.h5
Shifting spectrum
Shifting spectrum rj201.587
Attempting shift to spectrum NSO, median cross-correlation peak = 2.69
Attempting shift to spectrum 123239, median cross-correlation peak = 2.79
Attempting shift to spectrum 222368, median cross-correlation peak = 1.76
Attempting shift to spectrum 216899, median cross-correlation peak = 1.14
Best reference for shifting: 123239
Shifting entire spectrum
Matching spectrum
Matching region (5000, 5100)
/Users/petigura/anaconda/lib/python2.7/site-packages/lmfit/minimizer.py:532: RuntimeWarning: divide by zero encountered in double_scalars
  result.redchi = result.chisqr / result.nfree
Matching region (5100, 5200)
Matching region (5200, 5300)
Matching region (5300, 5400)
Matching region (5400, 5500)
Matching region (5500, 5600)
Matching region (5600, 5700)
Matching region (5700, 5800)
Matching region (5800, 5900)
Creating linear combinations
Linear combinations in region (5000, 5100)
Linear combinations in region (5100, 5200)
Linear combinations in region (5200, 5300)
Linear combinations in region (5300, 5400)
Linear combinations in region (5400, 5500)
Linear combinations in region (5500, 5600)
Linear combinations in region (5600, 5700)
Linear combinations in region (5700, 5800)
Linear combinations in region (5800, 5900)
ValueError: "Unknown format code 'f' for object of type 'str'"
> /Users/petigura/anaconda/lib/python2.7/site-packages/specmatchemp/core.py(79)specmatch_spectrum()
ValueError: "Unknown format code 'f' for object of type 'str'"
> /Users/petigura/anaconda/lib/python2.7/site-packages/specmatchemp/core.py(79)specmatch_spectrum()
-> print("{0}: {1:.2f}".format(p, sm.results[p]))
(Pdb) sm.results[p]
'Teff'
(Pdb) sm.results
{'Teff': 'Teff', 'u_Teff': 0.0, 'u_feh': 0.0, 'age': 'age', 'u_age': 0.0, 'feh': 'feh', 'logg': 'logg', 'u_logg': 0.0, 'radius': 'radius', 'u_mass': 0.0, 'mass': 'mass', 'u_radius': 0.0}
samuelyeewl commented 7 years ago

Hi Erik,

This should be fixed as of 4aac67f. You'll need to run setup.py again to download the new csv file containing the uncertainties.

petigura commented 7 years ago

Works now! Thanks!