{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Quickstart" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An interactive session with IOSACal in Jupyter Notebook is the best way to get familiar with the software and create beautiful reports that are also self-explaining. Reproducible science![^download]\n", "[^download]: This notebook can be downloaded as {nb-download}`quickstart.ipynb`.\n", "\n", "\n", "This is the standard import needed to start working with IOSACal and Jupyter Notebook:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from iosacal import R, combine, iplot\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Radiocarbon data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now define three radiocarbon determinations and combine them:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "rs = [R(3320, 65, 'LTL-32131'), R(3320,65,'LTL-123414'), R(3325,55,'LRS-8384')]\n", "cr = combine(rs)\n", "print(cr)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now that we have a combined age, calibrate it using the _IntCal20_ curve:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "calcr = cr.calibrate('intcal20')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The calibrated date can be plotted as normal:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "iplot(calcr)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Multiple dates\n", "\n", "IOSACal can plot multiple dates for comparing, and you can use Python as normal " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "rs = [R(7729, 80, \"P-1365\"),\n", " R(7661, 99, \"P-1375\"),\n", " R(7579, 86, \"P-827\"),\n", " R(7572, 92, \"P-772\"),\n", " R(7538, 89, \"P-778\"),\n", " R(7505, 93, \"P-769\")]\n", "multiple = [r.calibrate('intcal13') for r in rs]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It's also possible to change Matplotlib settings without need to edit the underlying source code:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "plt.style.use('ggplot')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And create the resulting plot:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "iplot(multiple)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Any plot can be saved directly to a file on disk, if needed:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "iplot(multiple, output=\"Catalhöyük East level VI A.pdf\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This was a quick tour of IOSACal used interactively in Jupyter. Thank you!" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.0" } }, "nbformat": 4, "nbformat_minor": 1 }