Thanks for your post. As my pal, Marcy noted below, living near a train station or train tracks in Mountain View, CA is pretty safe. I've lived in this county all of my life, and I cannot remember any incidents of a train derailment in Mountain View or any area in the county. Part of the reason, of course, is that our commuter trains are required to travel at much slower speeds--usually only the same speed as surrounding traffic, so the potential for problems (even with multi-cars) is extremely limited at 30-40 mph.
Although train issues are not a severe component in choosing a home next to the railways, I'd heed Marcy's sage advice about home values next to a railroad track or railroad station. I lived across from the rails for about a year and the first month it was very noisy because commuter trains travel on those rails about 1x every 30 minutes in the morning and the same frequency in the afternoon. Because sound isn't a huge issue for me, I acclimated ot the noise fairly quickly and never seemed to "hear" it after a while. So, while some people don't mind the train (or, in fact, love the sound of it), others will find the possibility a deterrent to buying the home and the value will need to be adjusted in consideration of the added inconvenience of sound.
Allison James Estates & Homes