{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n",
"(1.1 * u.eV).to(u.micron)\n",
"
\n",
"\n",
"produces this error:\n",
"\n",
"\n",
"UnitConversionError: 'eV' (energy) and 'micron' (length) are not convertible\n",
"
\n",
"\n",
"That's actually good, because one of the benefits of this module is to help you not make unit mistakes. In this case, however, we know what we're doing, so we can tell astropy that we want to convert between these units by using a certain kind of equivalence, in this case the one called `spectral`:"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/latex": [
"$1127.129 \\; \\mathrm{nm}$"
],
"text/plain": [
"