diff --git a/docs/source/tutorial.ipynb b/docs/source/tutorial.ipynb
index 5e4fc8d..92db2a9 100644
--- a/docs/source/tutorial.ipynb
+++ b/docs/source/tutorial.ipynb
@@ -118,7 +118,7 @@
"data": {
"text/html": [
"\n",
- "
\n",
+ "
\n",
"
\n",
" \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12515.699706446017\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12940.58481990226\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.99999497668534,\n",
+ " \"Dec\": 13.000001835269385,\n",
+ " \"Glon\": 280.56811463100814,\n",
+ " \"Glat\": 74.84475460794316,\n",
+ " \"SGL\": 102.09834270874016,\n",
+ " \"SGB\": -2.8320379440905414,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12515.699706446017,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12940.58481990226,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12515.699706446017 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12940.58481990226 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13)"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -725,12 +883,14 @@
"source": [
"## PyCF3 Cache system\n",
"\n",
- "By default any `pycf3.CF3` instance is created with a cache that prevent to send two times the same request to the server. For example: lets make two times the same request with time measurement"
+ "By default any any client instance is created with a cache that prevent to send two times the same request to the server. For example: lets make two times the same request and meassure the time to end the calculation.\n",
+ "\n",
+ "> Note: We are using the `pycf3.CF3` client as an example, but any other `pycf3` calculator has the same functionalities."
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
@@ -739,11 +899,22 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 18,
"metadata": {
"nbsphinx": "hidden"
},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "19"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"## this cell is hidden in sphinx (see the cell metadata)\n",
"cf3.cache.clear()"
@@ -751,41 +922,473 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 19,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 36 µs, sys: 9.57 ms, total: 9.61 ms\n",
+ "Wall time: 11.9 s\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12515.699706446017\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12940.58481990226\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.99999497668534,\n",
+ " \"Dec\": 13.000001835269385,\n",
+ " \"Glon\": 280.56811463100814,\n",
+ " \"Glat\": 74.84475460794316,\n",
+ " \"SGL\": 102.09834270874016,\n",
+ " \"SGB\": -2.8320379440905414,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12515.699706446017,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12940.58481990226,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12515.699706446017 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12940.58481990226 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search()"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 20,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 1.4 ms, sys: 471 µs, total: 1.87 ms\n",
+ "Wall time: 1.25 ms\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12515.699706446017\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12940.58481990226\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.99999497668534,\n",
+ " \"Dec\": 13.000001835269385,\n",
+ " \"Glon\": 280.56811463100814,\n",
+ " \"Glat\": 74.84475460794316,\n",
+ " \"SGL\": 102.09834270874016,\n",
+ " \"SGB\": -2.8320379440905414,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12515.699706446017,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12940.58481990226,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12515.699706446017 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12940.58481990226 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search()"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "As you can se the first time the total time is **17 seconds** and de the second time is only **6.56 ms**. This is because the project store te result on the local hardrive to avoid repeat the requests (by default a folfer called `pycf3_data`, is created in the user home)\n",
+ "As you can se the first time the total time is more than **10 seconds** and de the second time is in the order of the **ms**. This is because the project store te result on the local hardrive to avoid repeat the requests (by default a folfer called `pycf3_data`, is created in the user home)\n",
"\n",
"But if we change the request by asking for another declination, this gonna be slow again:"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 21,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 37.2 ms, sys: 0 ns, total: 37.2 ms\n",
+ "Wall time: 11.7 s\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13.5) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12512.725297090401\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12937.406568949371\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.9999950300572,\n",
+ " \"Dec\": 13.500001835269389,\n",
+ " \"Glon\": 279.88275558287694,\n",
+ " \"Glat\": 75.31258412600853,\n",
+ " \"SGL\": 101.61924751937396,\n",
+ " \"SGB\": -2.687124276261474,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12512.725297090401,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12937.406568949371,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13.5)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12512.725297090401 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12937.406568949371 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search(dec=13.5)"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13.5)"
]
},
{
@@ -797,12 +1400,156 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 22,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 2.4 ms, sys: 0 ns, total: 2.4 ms\n",
+ "Wall time: 1.58 ms\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13.5) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12512.725297090401\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12937.406568949371\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.9999950300572,\n",
+ " \"Dec\": 13.500001835269389,\n",
+ " \"Glon\": 279.88275558287694,\n",
+ " \"Glat\": 75.31258412600853,\n",
+ " \"SGL\": 101.61924751937396,\n",
+ " \"SGB\": -2.687124276261474,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12512.725297090401,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12937.406568949371,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13.5)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12512.725297090401 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12937.406568949371 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search(dec=13.5)"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13.5)"
]
},
{
@@ -814,7 +1561,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
@@ -830,12 +1577,156 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 25,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 2.45 ms, sys: 506 µs, total: 2.96 ms\n",
+ "Wall time: 1.92 ms\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12515.699706446017\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12940.58481990226\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.99999497668534,\n",
+ " \"Dec\": 13.000001835269385,\n",
+ " \"Glon\": 280.56811463100814,\n",
+ " \"Glat\": 74.84475460794316,\n",
+ " \"SGL\": 102.09834270874016,\n",
+ " \"SGB\": -2.8320379440905414,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12515.699706446017,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12940.58481990226,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12515.699706446017 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12940.58481990226 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 25,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search()"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13)"
]
},
{
@@ -847,9 +1738,20 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 26,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "2"
+ ]
+ },
+ "execution_count": 26,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"cf3.cache.clear()"
]
@@ -863,12 +1765,21 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 28,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 8.91 ms, sys: 239 µs, total: 9.15 ms\n",
+ "Wall time: 15.4 s\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search()\n",
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13.5)\n",
"\n",
"import time\n",
"time.sleep(3) # lets sleep 3 seconds"
@@ -883,12 +1794,156 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 30,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 8.1 ms, sys: 1.25 ms, total: 9.35 ms\n",
+ "Wall time: 11.5 s\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13.5) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12512.725297090401\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12937.406568949371\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.9999950300572,\n",
+ " \"Dec\": 13.500001835269389,\n",
+ " \"Glon\": 279.88275558287694,\n",
+ " \"Glat\": 75.31258412600853,\n",
+ " \"SGL\": 101.61924751937396,\n",
+ " \"SGB\": -2.687124276261474,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12512.725297090401,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12937.406568949371,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13.5)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12512.725297090401 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12937.406568949371 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 30,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search()"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13.5)"
]
},
{
@@ -900,12 +1955,156 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 31,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 2.01 ms, sys: 631 µs, total: 2.64 ms\n",
+ "Wall time: 1.72 ms\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ " \n",
+ " Result - CF3(distance=180, ra=187, dec=13.5) \n",
+ " | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Observed | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12512.725297090401\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " Adjusted | \n",
+ " Distance (Mpc) | \n",
+ " \n",
+ " [180.]\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " Velocity (Km/s) | \n",
+ " \n",
+ " 12937.406568949371\n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " Show/Hide Raw\n",
+ " \n",
+ "
\n",
+ " \n",
+ "{\n",
+ " \"message\": \"Success\",\n",
+ " \"RA\": 186.9999950300572,\n",
+ " \"Dec\": 13.500001835269389,\n",
+ " \"Glon\": 279.88275558287694,\n",
+ " \"Glat\": 75.31258412600853,\n",
+ " \"SGL\": 101.61924751937396,\n",
+ " \"SGB\": -2.687124276261474,\n",
+ " \"observed\": {\n",
+ " \"velocity\": 12512.725297090401,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " },\n",
+ " \"adjusted\": {\n",
+ " \"velocity\": 12937.406568949371,\n",
+ " \"distance\": [\n",
+ " 180.0\n",
+ " ]\n",
+ " }\n",
+ "}\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "Result - CF3(distance=180, ra=187, dec=13.5)\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Observed | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12512.725297090401 |\n",
+ "+----------+-----------------+--------------------+\n",
+ "| Adjusted | Distance (Mpc) | [180.] |\n",
+ "| | Velocity (Km/s) | 12937.406568949371 |\n",
+ "+----------+-----------------+--------------------+"
+ ]
+ },
+ "execution_count": 31,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"%%time\n",
- "cf3.equatorial_search()"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13.5)"
]
},
{
@@ -945,9 +2144,20 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 32,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "CF3(calculator='CF3', cache_dir='', cache_expire=None)"
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"cf3 = pycf3.CF3(cache=pycf3.NoCache())\n",
"cf3"
@@ -966,15 +2176,17 @@
"source": [
"## PyCF3 Retry\n",
"\n",
- "By default any `pycf3.CF3` instance try **3 times** to perform a request.\n",
+ "By default any calculator instance try **3 times** to perform a request.\n",
"if you want to add more retries you need to change the default `session` of the instance.\n",
"\n",
+ "> Note: We are using the `pycf3.CF3` client as an example, but any other `pycf3` calculator has the same functionalities.\n",
+ "\n",
"For example if you want to try 2 times:"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
@@ -991,11 +2203,22 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 34,
"metadata": {
"nbsphinx": "hidden"
},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "1"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"## this cell is hidden in sphinx (see the cell metadata)\n",
"cf3.cache.clear()"
@@ -1003,13 +2226,62 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 35,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "ConnectionError",
+ "evalue": "HTTPConnectionPool(host='edd.ifa.hawaii.edu', port=80): Max retries exceeded with url: /CF3calculator/api.php (Caused by ReadTimeoutError(\"HTTPConnectionPool(host='edd.ifa.hawaii.edu', port=80): Read timed out. (read timeout=5)\"))",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mtimeout\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36m_make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 420\u001b[0m \u001b[0;31m# Otherwise it looks like a bug in the code.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 421\u001b[0;31m \u001b[0msix\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mraise_from\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 422\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mSocketTimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBaseSSLError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSocketError\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/six.py\u001b[0m in \u001b[0;36mraise_from\u001b[0;34m(value, from_value)\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36m_make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 415\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 416\u001b[0;31m \u001b[0mhttplib_response\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetresponse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 417\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mBaseException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m/usr/lib/python3.8/http/client.py\u001b[0m in \u001b[0;36mgetresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1346\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1347\u001b[0;31m \u001b[0mresponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbegin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1348\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mConnectionError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m/usr/lib/python3.8/http/client.py\u001b[0m in \u001b[0;36mbegin\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 306\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 307\u001b[0;31m \u001b[0mversion\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatus\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreason\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_read_status\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 308\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstatus\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mCONTINUE\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m/usr/lib/python3.8/http/client.py\u001b[0m in \u001b[0;36m_read_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 267\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_read_status\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 268\u001b[0;31m \u001b[0mline\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_MAXLINE\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"iso-8859-1\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 269\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0m_MAXLINE\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m/usr/lib/python3.8/socket.py\u001b[0m in \u001b[0;36mreadinto\u001b[0;34m(self, b)\u001b[0m\n\u001b[1;32m 668\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 669\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv_into\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 670\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31mtimeout\u001b[0m: timed out",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mReadTimeoutError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 664\u001b[0m \u001b[0;31m# Make the request on the httplib connection object.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 665\u001b[0;31m httplib_response = self._make_request(\n\u001b[0m\u001b[1;32m 666\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36m_make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 422\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mSocketTimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBaseSSLError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSocketError\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 423\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_raise_timeout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0merr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_value\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mread_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 424\u001b[0m \u001b[0;32mraise\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36m_raise_timeout\u001b[0;34m(self, err, url, timeout_value)\u001b[0m\n\u001b[1;32m 329\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0merr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSocketTimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 330\u001b[0;31m raise ReadTimeoutError(\n\u001b[0m\u001b[1;32m 331\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"Read timed out. (read timeout=%s)\"\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0mtimeout_value\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31mReadTimeoutError\u001b[0m: HTTPConnectionPool(host='edd.ifa.hawaii.edu', port=80): Read timed out. (read timeout=5)",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mMaxRetryError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/requests/adapters.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 438\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mchunked\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 439\u001b[0;31m resp = conn.urlopen(\n\u001b[0m\u001b[1;32m 440\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 746\u001b[0m )\n\u001b[0;32m--> 747\u001b[0;31m return self.urlopen(\n\u001b[0m\u001b[1;32m 748\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 746\u001b[0m )\n\u001b[0;32m--> 747\u001b[0;31m return self.urlopen(\n\u001b[0m\u001b[1;32m 748\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 718\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 719\u001b[0;31m retries = retries.increment(\n\u001b[0m\u001b[1;32m 720\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merror\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_pool\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_stacktrace\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexc_info\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/urllib3/util/retry.py\u001b[0m in \u001b[0;36mincrement\u001b[0;34m(self, method, url, response, error, _pool, _stacktrace)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mnew_retry\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_exhausted\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 436\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mMaxRetryError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pool\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merror\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mResponseError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcause\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 437\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31mMaxRetryError\u001b[0m: HTTPConnectionPool(host='edd.ifa.hawaii.edu', port=80): Max retries exceeded with url: /CF3calculator/api.php (Caused by ReadTimeoutError(\"HTTPConnectionPool(host='edd.ifa.hawaii.edu', port=80): Read timed out. (read timeout=5)\"))",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mConnectionError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m
\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# no more than 5 seconds between every request\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mcf3\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalculate_velocity\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdistance\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m180\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mra\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m187\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m13.5\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
+ "\u001b[0;32m~/proyectos/cf3/src/pycf3.py\u001b[0m in \u001b[0;36mcalculate_velocity\u001b[0;34m(self, distance, ra, dec, glon, glat, sgl, sgb, **get_kwargs)\u001b[0m\n\u001b[1;32m 902\u001b[0m \u001b[0mra\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mra\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdec\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mglon\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mglon\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mglat\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mglat\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msgl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msgl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msgb\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msgb\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 903\u001b[0m )\n\u001b[0;32m--> 904\u001b[0;31m response = self._search(\n\u001b[0m\u001b[1;32m 905\u001b[0m \u001b[0mcoordinate_system\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcoordinate_system\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 906\u001b[0m \u001b[0malpha\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0malpha\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/src/pycf3.py\u001b[0m in \u001b[0;36m_search\u001b[0;34m(self, coordinate_system, alpha, delta, distance, velocity, **get_kwargs)\u001b[0m\n\u001b[1;32m 727\u001b[0m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcache\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdefault\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdcache\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcore\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mENOVAL\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mretry\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 728\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mresponse\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mdcache\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcore\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mENOVAL\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 729\u001b[0;31m response = self.session.get(\n\u001b[0m\u001b[1;32m 730\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mURL\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpayload\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mget_kwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 731\u001b[0m )\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/requests/sessions.py\u001b[0m in \u001b[0;36mget\u001b[0;34m(self, url, **kwargs)\u001b[0m\n\u001b[1;32m 544\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 545\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msetdefault\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'allow_redirects'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 546\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'GET'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 547\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 548\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0moptions\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/requests/sessions.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 531\u001b[0m }\n\u001b[1;32m 532\u001b[0m \u001b[0msend_kwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msettings\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m \u001b[0mresp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0msend_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/requests/sessions.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 644\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 645\u001b[0m \u001b[0;31m# Send the request\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 646\u001b[0;31m \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0madapter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 647\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 648\u001b[0m \u001b[0;31m# Total elapsed time of the request (approximately)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m~/proyectos/cf3/lib/python3.8/site-packages/requests/adapters.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 514\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mSSLError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 515\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 516\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mConnectionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 517\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 518\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mClosedPoolError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31mConnectionError\u001b[0m: HTTPConnectionPool(host='edd.ifa.hawaii.edu', port=80): Max retries exceeded with url: /CF3calculator/api.php (Caused by ReadTimeoutError(\"HTTPConnectionPool(host='edd.ifa.hawaii.edu', port=80): Read timed out. (read timeout=5)\"))"
+ ]
+ }
+ ],
"source": [
"# no more than 5 seconds between every request\n",
- "cf3.equatorial_search(timeout=5)"
+ "cf3.calculate_velocity(distance=180, ra=187, dec=13.5, timeout=5)"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {