{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "# Imagery\n", "\n", "The **Cuneiform Digital Library Initiative** [CDLI](https://cdli.ucla.edu)\n", "contains photographic and lineart imagery for tablets and individual ideographs in the\n", "[Uruk IV/III](http://cdli.ox.ac.uk/wiki/doku.php?id=proto-cuneiform)\n", "corpus.\n", "\n", "Here we show how we can employ them.\n", "\n", "More details of the provenance of the images can be found\n", "in [about](https://github.com/Nino-cunei/uruk/blob/master/docs/images.md)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The `lineart` and `photo` and `cdli` functions\n", "\n", "We have made utility functions `lineart(nodes)` and `photo(nodes)` in the *cunei* module.\n", "They look up the photos and linearts for nodes, and show them in a row.\n", "\n", "The `cdli(node)` function produces a link to the archival page of the tablet corresponding to `node`.\n", "\n", "**Caveat:** We will use a few functions we have not explained before.\n", "See this chapter as a showcase of what can be done.\n", "You want to return to this after you have digested further chapters." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Start up\n", "\n", "We import the Python modules we need." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2018-05-11T09:55:49.273562Z", "start_time": "2018-05-11T09:55:49.213976Z" } }, "outputs": [], "source": [ "import sys, os\n", "from tf.app import use" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We set up our working locations on the file system." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2018-05-11T09:55:52.338159Z", "start_time": "2018-05-11T09:55:51.035984Z" }, "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Using TF app uruk in /Users/dirk/github/annotation/app-uruk/code\n", "Using Nino-cunei/uruk/tf/uruk - 1.0 in /Users/dirk/github\n" ] }, { "data": { "text/markdown": [ "**Documentation:** URUK Character table Feature docs uruk API Text-Fabric API 7.3.8 Search Reference" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Loaded features:\n", "

Uruk IV/III: Proto-cuneiform tablets : catalogId crossref damage depth excavation fragment fullNumber grapheme identifier modifier modifierFirst modifierInner name number otype period prime remarkable repeat srcLn srcLnNum terminal text type uncertain variant variantOuter written comments op oslots sub

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
API members:\n", "C Computed, Call AllComputeds, Cs ComputedString
\n", "E Edge, Eall AllEdges, Es EdgeString
\n", "ensureLoaded, TF, ignored, loadLog
\n", "L Locality
\n", "cache, error, indent, info, reset
\n", "N Nodes, sortKey, sortKeyTuple, otypeRank, sortNodes
\n", "F Feature, Fall AllFeatures, Fs FeatureString
\n", "S Search
\n", "T Text
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Using Nino-cunei/uruk/sources/cdli/images in /Users/dirk/github\n", "Found 2095 ideograph linearts\n", "Found 2724 tablet linearts\n", "Found 5495 tablet photos\n" ] } ], "source": [ "A = use('uruk', hoist=globals())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Tablets\n", "\n", "We will work with two example tablets." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:41:47.411111Z", "start_time": "2018-05-01T13:41:47.406653Z" } }, "outputs": [], "source": [ "pNum1 = 'P000014'\n", "pNum2 = 'P000022'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's first show the pretty displays of their transcriptions." ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "p1Node = T.tabletNode(pNum1)\n", "p2Node = T.tabletNode(pNum2)" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " \n", "\n", "
\n", " \n", "
\n", "
\n", " \n", "
\n", " meta\n", " \n", "
\n", "\n", "
\n", "
atf: lang qpc
\n", " \n", "
\n", "\n", "
\n", "
\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " obverse\n", " \n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " 0\n", " \n", "
\n", "\n", "
\n", " \n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " 1\n", " \n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " 1(N01)
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU686~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " KA~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " E2~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " E2~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " KA~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " LAGAB~b
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " reverse\n", " \n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", " ruling\n", " \n", "
\n", "\n", "
\n", "
blank space
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", " \n", "
\n", " meta\n", " \n", "
\n", "\n", "
\n", "
scrunched together
\n", " \n", "
\n", "\n", "
\n", "
\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.pretty(p2Node)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want only one face, you can do that." ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "data": { "text/html": [ "P000022\n", "\n", "
\n", " \n", "
\n", " face obverse\n", " \n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " 0\n", " \n", "
\n", "\n", "
\n", " \n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " 1\n", " \n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " 1(N01)
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU686~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " KA~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " E2~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " E2~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " KA~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " LAGAB~b
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "P000022\n", "\n", "
\n", " \n", "
\n", " face reverse\n", " \n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", " ruling\n", " \n", "
\n", "\n", "
\n", "
blank space
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", " \n", "
\n", " meta\n", " \n", "
\n", "\n", "
\n", "
scrunched together
\n", " \n", "
\n", "\n", "
\n", "
\n", "
\n", "\n", "\n", "
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for f in L.d(p2Node, otype='face'):\n", " A.pretty(f)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Or we could do it per column:" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", "
\n", " column 0\n", " 180530\n", "
\n", "\n", "
\n", " \n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " 1\n", " 227556\n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1107\n", "
\n", "\n", "
\n", " 1(N01)
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1108\n", "
\n", "\n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1109\n", "
\n", "\n", "
\n", " ZATU686~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1110\n", "
\n", "\n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1111\n", "
\n", "\n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1112\n", "
\n", "\n", "
\n", " KA~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1113\n", "
\n", "\n", "
\n", " E2~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1114\n", "
\n", "\n", "
\n", " E2~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1115\n", "
\n", "\n", "
\n", " KA~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1116\n", "
\n", "\n", "
\n", " LAGAB~b
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", " \n", "
\n", " \n", " 1117\n", "
\n", "\n", "
\n", " ZATU707~a
\n", " \n", "
\n", "\n", "
\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n", "\n", "\n", "
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for f in L.d(p2Node, otype='column'):\n", " A.pretty(f, withNodes=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We start with showing one photo.\n", "Note, that if you click on the photo, \n", "you will be taken to a higher resolution version on CDLI.\n", "\n", "And if you click on the caption, you will be taken to the main page for the tablet on CDLI." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:41:56.665462Z", "start_time": "2018-05-01T13:41:56.655046Z" }, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo(pNum1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want it smaller, you can set the width.\n", "\n", "The width may be an integer indicating the amount of pixels, or any string that is acceptable\n", "as a measure in\n", "[CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/length)." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:05.624596Z", "start_time": "2018-05-01T13:42:05.615191Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo(pNum1, width=200)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:07.559504Z", "start_time": "2018-05-01T13:42:07.551428Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo(pNum1, width=\"10em\")" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "If you do not want to show the caption, say:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:09.007589Z", "start_time": "2018-05-01T13:42:08.995427Z" } }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo(pNum1, width=100, withCaption=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can position the caption:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:11.284031Z", "start_time": "2018-05-01T13:42:11.273275Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo(pNum1, width=100, withCaption='top')" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:13.038386Z", "start_time": "2018-05-01T13:42:13.028012Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo(pNum1, width=100, withCaption='left')" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:14.360684Z", "start_time": "2018-05-01T13:42:14.348821Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo(pNum1, width=100, withCaption='right')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Instead of providing a P-number, you can also specify a node:" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:16.152991Z", "start_time": "2018-05-01T13:42:16.147640Z" } }, "outputs": [], "source": [ "tablet1 = T.nodeFromSection((pNum1,))\n", "tablet2 = T.nodeFromSection((pNum2,))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want to show them in a row:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:18.527386Z", "start_time": "2018-05-01T13:42:18.517665Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo([tablet1, tablet2], height=\"200\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want to show the links only, not the images themselves:" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:19.735577Z", "start_time": "2018-05-01T13:42:19.723446Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo([tablet1, tablet2], asLink=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you also want the links to the main pages on CDLI:" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:21.212384Z", "start_time": "2018-05-01T13:42:21.205011Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.photo([tablet1, tablet2], asLink=True, withCaption='bottom')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Lineart\n", "\n", "### Tablets\n", "\n", "We show the lineart for our example tablets:" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:22.511586Z", "start_time": "2018-05-01T13:42:22.499581Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart([pNum1, pNum2])" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Again, we can identify the tablets equally well with their nodes.\n", "Let's make them smaller:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:24.227485Z", "start_time": "2018-05-01T13:42:24.218813Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart([tablet1, tablet2], width=100)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can set a height and a width, they act as maximum constraints." ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:25.482675Z", "start_time": "2018-05-01T13:42:25.467378Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart([tablet1, tablet2], width=200, height=100)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you insist that the width should be fully realized, you can use a `!` in fron of the value." ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:26.994644Z", "start_time": "2018-05-01T13:42:26.982651Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart([tablet1, tablet2], width='!200', height=100)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that this distorts the aspect ratio.\n", "But sometimes you may want that." ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:28.478534Z", "start_time": "2018-05-01T13:42:28.470203Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart([tablet1, tablet2], width='!200', height='!200')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Keys\n", "\n", "Some tablets have additional linearts.\n", "We can select them by their *key*. \n", "The default lineart is keyed by the empty string,\n", "and this one will be chosen if you do not pass a key, as we did above.\n", "\n", "In order to know which keys there are for a tablet, just call lineart with a non-existing key:" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:29.937136Z", "start_time": "2018-05-01T13:42:29.929925Z" } }, "outputs": [], "source": [ "pNum3 = 'P003553'" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:32.110769Z", "start_time": "2018-05-01T13:42:32.102720Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(pNum3, key='xxx')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So this tablet has the empty key, and also key `d`.\n", "Let's get the latter one:" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:33.556411Z", "start_time": "2018-05-01T13:42:33.546349Z" }, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(pNum3, key='d')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A bit smaller:" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:36.494808Z", "start_time": "2018-05-01T13:42:36.482889Z" }, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(pNum3, key='d', width=600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We navigate to a famous example tablet and show the lineart." ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:37.846120Z", "start_time": "2018-05-01T13:42:37.838632Z" } }, "outputs": [], "source": [ "pNumX = 'P005381'" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:39.331526Z", "start_time": "2018-05-01T13:42:39.322281Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(pNumX, width=300)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We also want to see the transcription." ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:40.742281Z", "start_time": "2018-05-01T13:42:40.734533Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "&P005381 = MSVO 3, 70\n", "#atf: lang qpc \n", "@obverse \n", "@column 1 \n", "1.a. 2(N14) , SZE~a SAL TUR3~a NUN~a \n", "1.b. 3(N19) , |GISZ.TE| \n", "2. 1(N14) , NAR NUN~a SIG7 \n", "3. 2(N04)# , PIRIG~b1 SIG7 URI3~a NUN~a \n", "@column 2 \n", "1. 3(N04) , |GISZ.TE| GAR |SZU2.((HI+1(N57))+(HI+1(N57)))| GI4~a \n", "2. , GU7 AZ SI4~f \n", "@reverse \n", "@column 1 \n", "1. 3(N14) , SZE~a \n", "2. 3(N19) 5(N04) , \n", "3. , GU7 \n", "@column 2 \n", "1. , AZ SI4~f \n" ] } ], "source": [ "tabletX = T.nodeFromSection((pNumX,))\n", "sourceLines = A.getSource(tabletX)\n", "print('\\n'.join(sourceLines))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Ideographs\n", "\n", "We want to show the ideographs for case `1.a` in column 1.\n", "\n", "If you click on an ideograph, you will be taken to the image file on CDLI.\n", "However, due to some discrepancies between the ideographs in the CDLI big list and their\n", "download package, some of these links may be broken." ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:42.473189Z", "start_time": "2018-05-01T13:42:42.443797Z" }, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "case = A.nodeFromCase((pNumX, 'obverse:1', '1a'))\n", "for ideo in A.getOuterQuads(case):\n", " A.lineart(ideo, withCaption=False, height=50)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that the images are stacked vertically." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Images in a row\n", "\n", "You can also have `lineart()` put images in a row.\n", "Just pass multiple nodes to it.\n", "\n", "In this case we also show the captions.\n", "The link under the caption goes to a big list on CDLI with all ideographs." ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:44.365883Z", "start_time": "2018-05-01T13:42:44.355636Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(A.getOuterQuads(case), height=50)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also call up these images by the name of the quad or sign:" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:45.855177Z", "start_time": "2018-05-01T13:42:45.843138Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(['2(N14)', 'SZE~a', 'SAL', 'TUR3~a', 'NUN~a'], height=50, withCaption='top')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Existence of images\n", "\n", "Sometimes you want to test whether an image exists.\n", "So far, if an image does not exist, a placeholder warning text is output.\n", "\n", "But if you say `warning=False`, the empty string is output.\n", "\n", "That makes it easy to test whether an image is present and do something about it." ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:47.791160Z", "start_time": "2018-05-01T13:42:47.786280Z" } }, "outputs": [], "source": [ "pNum3 = 'P000013'" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:48.395559Z", "start_time": "2018-05-01T13:42:48.389296Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(pNum3)" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:49.078773Z", "start_time": "2018-05-01T13:42:49.069948Z" } }, "outputs": [ { "data": { "text/plain": [ "''" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.lineart(pNum3, warning=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we prefer lineart, but in its absence accept a photo, we can say:" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:50.746164Z", "start_time": "2018-05-01T13:42:50.734069Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(pNum3, warning=False) or A.photo(pNum3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When there is lineart, it will be chosen:" ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:52.688632Z", "start_time": "2018-05-01T13:42:52.673858Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "True" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.lineart(pNum2, warning=False) or A.photo(pNum2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Likewise, you can test wether there is lineart for ideographs:" ] }, { "cell_type": "code", "execution_count": 36, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:54.165012Z", "start_time": "2018-05-01T13:42:54.158333Z" } }, "outputs": [ { "data": { "text/plain": [ "'no lineart for SZE'" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.lineart('SZE', warning=False) or 'no lineart for SZE'" ] }, { "cell_type": "code", "execution_count": 37, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:56.892033Z", "start_time": "2018-05-01T13:42:56.877671Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "True" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A.lineart('SZE~a', warning=False) or 'no lineart for SZE~a'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An other, direct way to test whether an image is present is this:" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:58.032412Z", "start_time": "2018-05-01T13:42:58.024273Z" } }, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "'SZE' in A.imagery('ideograph', 'lineart')" ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:58.500622Z", "start_time": "2018-05-01T13:42:58.493761Z" } }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "'SZE~a' in A.imagery('ideograph', 'lineart')" ] }, { "cell_type": "code", "execution_count": 40, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:58.951438Z", "start_time": "2018-05-01T13:42:58.945547Z" } }, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "'P000013' in A.imagery('tablet', 'lineart')" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:42:59.423011Z", "start_time": "2018-05-01T13:42:59.415313Z" } }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "'P000013' in A.imagery('tablet', 'photo')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also get the lists of things for which there are images:" ] }, { "cell_type": "code", "execution_count": 42, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:43:01.650320Z", "start_time": "2018-05-01T13:43:01.643098Z" } }, "outputs": [ { "data": { "text/plain": [ "2095" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ideos = A.imagery('ideograph', 'lineart')\n", "len(ideos)" ] }, { "cell_type": "code", "execution_count": 43, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:43:02.455377Z", "start_time": "2018-05-01T13:43:02.446602Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1(N01) 1(N01@f) 1(N02) 1(N03) 1(N04) 1(N04@f) 1(N05) 1(N06) 1(N07~a) 1(N07~b) 1(N08) 1(N08@f) 1(N08~b) 1(N09) 1(N11) 1(N12) 1(N14) 1(N14@f) 1(N15) 1(N16) 1(N17) 1(N18) 1(N19) 1(N19@f) 1(N20) 1(N22) 1(N22@f) 1(N23) 1(N24) 1(N24@f) 1(N24~a) 1(N24~b) 1(N25) 1(N26) 1(N26~b) 1(N27) 1(N28) 1(N28~b) 1(N28~c) 1(N29A~b) 1(N29A~c) 1(N29~a) 1(N29~b) 1(N30A~c) 1(N30C~b) 1(N30C~c) 1(N30~a) 1(N30~c) 1(N30~d) 1(N30~e) 1(N31) 1(N32) 1(N33) 1(N34) 1(N34@f) 1(N35) 1(N36) 1(N36@f) 1(N37) 1(N38) 1(N39~a) 1(N39~b) 1(N40) 1(N41) 1(N42~a) 1(N42~b) 1(N43) 1(N44) 1(N45) 1(N45@f) 1(N45~a) 1(N46) 1(N46@f) 1(N47) 1(N48) 1(N48@f) 1(N49) 1(N50) 1(N51) 1(N51@f) 1(N52) 1(N54) 1(N55) 1(N56) 1(N57) 1(N58) 1(N60) 1(N63) 10(N01) 10(N14) 10(N14@f) 10(N57) 10(N58) 12(N14) 12(N58) 2(LAGAB~a) 2(N01) 2(N01@f) 2(N02) 2(N03)\n" ] } ], "source": [ "print(' '.join(sorted(ideos)[0:100]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We make a list of all UKKIN ideographs:" ] }, { "cell_type": "code", "execution_count": 44, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:43:03.557067Z", "start_time": "2018-05-01T13:43:03.538742Z" } }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "ukkin = sorted(i for i in ideos if 'UKKIN' in i)\n", "A.lineart(ukkin, height=30, withCaption=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Or a bit bigger, vertically stacked:" ] }, { "cell_type": "code", "execution_count": 45, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:43:05.947306Z", "start_time": "2018-05-01T13:43:05.904995Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for u in ukkin:\n", " A.lineart(u, width=50, withCaption='right')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Annotated images\n", "\n", "If you want to use an annotated image in a markdown cell, just copy one of the\n", "images you find in the (new) `cdli-imagery` directory over to the `images` directory\n", "(or any near directory you like). You might want to give it an other name.\n", "\n", "Use an image editor to annotate the image, and use it like this:\n", "\n", "```markdown\n", "![dummy](images/P005381_l-obverse-1a.png)\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![dummy](images/P005381_l-obverse-1a.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want to resize, do this\n", "\n", "```html\n", "\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Online images\n", "\n", "If you do not need to call up images in your notebook, but you want the online\n", "links to their counterparts on CDLI, that is also possible.\n", "\n", "**N.B.:** Some of these links might be broken." ] }, { "cell_type": "code", "execution_count": 46, "metadata": { "ExecuteTime": { "end_time": "2018-05-01T13:43:09.892580Z", "start_time": "2018-05-01T13:43:09.881836Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.lineart(['2(N14)', 'SZE~a', 'SAL', 'TUR3~a', 'NUN~a'], asLink=True, width=50)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Next\n", "\n", "[steps](steps.ipynb)\n", "\n", "*One step at a time ...*\n", "\n", "All chapters:\n", "[start](start.ipynb)\n", "[imagery](imagery.ipynb)\n", "[steps](steps.ipynb)\n", "[search](search.ipynb)\n", "[signs](signs.ipynb)\n", "[quads](quads.ipynb)\n", "[jumps](jumps.ipynb)\n", "[cases](cases.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.1" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": true, "toc_position": { "height": "607px", "left": "0px", "right": "995px", "top": "110px", "width": "285px" }, "toc_section_display": "block", "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }