Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    In my first year in a lab I built a program 
    that scrapes the NIST spectral database, reads the data 
    from a spectrum analyzer attached to the computer, and
    figures out which types of atoms the thing the spectrum 
    analyzer is looking at contains. This is harder than it 
    sounds.
No no, trust me, that sounds hard. :-)



It may sound hard but most of it is pretty mundane. Scraping the NIST database is just a program visiting pages for wavelength ranges 0-100, 100-200 etc. to get all the data. Then it parses the HTML tables into a hash table indexed by element name ("H", "O", "C", "Na") which gives for each element an array of pairs of floating point numbers (wavelength of spectral line, strength of spectral line).

Talking to the spectrometer is boring too: you have your program execute some other program that comes with the spectrometer, which talks to the spectrometer and saves a file containing a list of floating point numbers which describes a graph like this (http://upload.wikimedia.org/wikipedia/en/thumb/5/5d/Spectra-...) with data points. The floating point numbers come in a weird format that the standard floating point parsing function can't handle, so you munge it a bit with a regex.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: