Stefano Costa

There's more than potsherds out here

Faccio l’archeologo e vivo a Genova

  • ArcheoFOSS: un saluto e buon viaggio

    ArcheoFOSS: un saluto e buon viaggio

    Un mese fa, pochi giorni dopo essere rientrato dall’incontro FOSS4G-IT di Padova, ho mandato una email a un gruppetto di 8 persone che, presenti fisicamente o meno a Padova, hanno seguito da vicino le vicende di ArcheoFOSS negli ultimi tempi. Con questa email ho salutato ArcheoFOSS e adesso, sedimentati un po’ i pensieri, pubblico questo articolo con un augurio di buon viaggio.

    L’edizione 2019 di ArcheoFOSS è stata ottima, sia dal punto di vista degli interventi sia come partecipazione numerica ai workshop. Ha funzionato abbastanza l’integrazione con gli amici di FOSS4G-IT, nonostante una certa ghettizzazione (aula lontana, niente streaming, niente computer pronto) di cui è rimasta traccia anche nei comunicati stampa conclusivi e nelle discussioni organizzative di coda. Non ho comunque potuto fare a meno di notare negli interventi un certo distacco tra chi presenta in modo occasionale e chi ha seguito negli anni un percorso collettivo di crescita, tra chi ha “usato l’open” e chi costruisce strumenti condivisi, conoscenza trasversale.

    Gli incontri però non si chiudono con la fine dell’ultima presentazione in sala. Come abbiamo detto a Padova, con grande sforzo mio, di Saverio Giulio Malatesta e soprattutto di Piergiovanna Grossi sono quasi ultimati gli atti del 2018 che saranno pubblicati in un supplemento di Archeologia e Calcolatori grazie alla disponibilità di Paola Moscati e alla volontà di tanti autori di autotassarsi per contribuire alla pubblicazione del volume.

    Ma veniamo al dunque.

    Condivido una decisione che ho maturato serenamente negli ultimi 6-12 mesi, cioè quella di fare un passo indietro e “uscire” da ArcheoFOSS per la prima volta dal lontano 2006 a Grosseto (quando non avevamo ancora questo nome, ma uno molto più lungo). Questo non perché io non condivida lo spirito che anima questo gruppo di persone, che anzi credo di continuare a coltivare e diffondere. Né perché io sia “arrivato” a occupare una posizione in soprintendenza dove non ho più bisogno di ArcheoFOSS come biglietto da visita (non che sia mai successo…).

    Vorrei metaforicamente uscire dalla porta dopo aver salutato, a differenza di tante altre persone che hanno fatto anche molto (penso a chi ha organizzato il workshop nelle edizioni 2006, 2010, 2011, 2012, 2013) senza poi avvisare in modo chiaro di non essere più a bordo.

    Semplicemente, se così posso dire, mi manca il tempo per fare con entusiasmo e passione le cose indispensabili (organizzare il workshop, pubblicare gli atti, ma anche tenere il tutto vivo per 12 mesi l’anno, gestire il sito, il forum) e non ho le energie per farle nemmeno in modo approssimativo. Non è l’unico impegno di questo genere che ho deciso di chiudere (a breve, per gli affezionati, altri aggiornamenti).

    ArcheoFOSS mi piace sempre moltissimo, anche se mi sembrano sempre più flebili l’anima quantitativa, quella metodologica, quella di rivendicazione che proprio nel 2006 erano un ingrediente fondamentale. Senza quelle, io penso che non si vada lontano. Penso anche che ArcheoFOSS troverebbe uno spazio più coerente a rapporto con realtà e incontri archeologici invece che recitando la parte “archeo” di un altro contenitore legato al software libero (perché così manca un confronto critico, una valutazione sulla bontà archeologica dei lavori presentati, e soprattutto la possibilità di incidere direttamente sulla pratica del settore). Questo ovviamente vale nella situazione attuale, in cui non ci sono risorse per organizzare un incontro autonomo.

    Passando alle questioni pratiche, come avevo anticipato, ho chiuso il forum Discorsi su ArcheoFOSS lasciando in sola lettura i contenuti pubblici. Questo ha suscitato una “lettera aperta” da parte di Emanuel Demetrescu, che dopo averla condivisa con me ha voluto pubblicarla anche su Facebook, non so con quale riscontro.

    Inoltre ho deciso che non farò parte del comitato scientifico per prossimi incontri.

    Mi piacerebbe moltissimo partecipare in futuro ad ArcheoFOSS presentando quello che credo di continuare a fare (software libero, banche dati, formati aperti). Quando è iniziata questa avventura avevo 23 anni e adesso ne ho quasi 36: non esagero dicendo che ho imparato moltissimo dalle tante persone che ho avuto la fortuna di incontrare in questi anni, e ne sono pubblicamente e dichiaratamente riconoscente. Ci incontreremo ancora.

    Nel frattempo, vi auguro buon viaggio.

  • Reproducible science per archeologi

    Reproducible science per archeologi

    Il 20 febbraio 2019, a Padova, tengo un workshop su Reproducible science per archeologi dentro il convegno FOSS4G-IT 2019. Avete tempo fino a mercoledì 13 febbraio per iscrivervi.

    Cosa facciamo

    Questo workshop guida i partecipanti nella creazione di una analisi di dati archeologici, secondo i canoni della reproducible science sempre più diffusi a livello internazionale e trasversale.

    Utilizzando software di elaborazione ben noti come il linguaggio R e l’ambiente di programmazione RStudio, partiremo da alcuni dataset e affronteremo i vari passaggi analitici che vengono trasposti sotto forma di codice: è una procedura pensata per rendere esplicito il processo di ricerca con i suoi meccanismi di tentativi ed errori, secondo il principio della ripetibilità sperimentale.

    I partecipanti potranno intervenire attivamente con me nella definizione del percorso e del prodotto finale del workshop, esplorando le pratiche più attuali della open science archeologica diffuse a livello internazionale.

    Ci colleghiamo ad altri workshop svolti negli anni scorsi negli USA da Ben Marwick e Matt Harris.

    Come iscriversi

    Vi potete registrare fino al 13 febbraio 2019 su questa pagina http://foss4g-it2019.gfoss.it/registrazione

    Per l’iscrizione è richiesto un pagamento di 10 € che vanno a coprire i costi organizzativi dell’evento – non serve a pagare il sottoscritto.

    Letture e riferimenti

    Per partecipare servirà avere installato R, RStudio e se possibile anche Git:

    Di seguito qualche link a letture utili per prepararsi al workshop:

  • Usare SIGECweb su macOS o GNU/Linux

    Usare SIGECweb su macOS o GNU/Linux

    SIGECweb è la piattaforma del Sistema informativo generale del catalogo accessibile via web.

    AGGIORNAMENTO 8 MAGGIO 2020: con il rilascio della versione di SIGECweb 2.1.0,   Il SIGECweb è ora compatibile con tutti i browser, quindi per il suo corretto utilizzo NON dovrà più essere utilizzata l’apposita versione (45.02) del browser Mozilla Firefox.

    Tramite SIGECweb tutti gli utenti abilitati (sia interni al Ministero, sia esterni) possono accedere al patrimonio informativo delle schede di catalogo per effettuare nuove catalogazioni, digitalizzazioni delle schede cartacee esistenti o campagne di revisione delle schede già inserite in banca dati, nonché ricerche estese. Si tratta di uno strumento fondamentale per la tutela del patrimonio culturale italiano.

    Da alcuni anni, per una serie di problemi tecnici, SIGECweb è accessibile solo tramite una specifica versione del browser Firefox, la 45, che l’Istituto Centrale per il Catalogo e la Documentazione (ICCD) mette a disposizione tramite il proprio sito. In pratica questa versione personalizzata non sostituisce il browser esistente ma viene installata esclusivamente per l’uso del SIGECweb.

    Il file di installazione fornito è disponibile solo per sistemi Windows, e una volta installato crea un nuovo profilo utente separato da quello principale (non troveremo la cronologia dei siti visitati, le password salvate, i segnalibri, le opzioni etc).

    Se abbiamo esigenza di usare SIGECweb da macOS o GNU/Linux, è possibile comunque seguire attentamente i suggerimenti riportati nell’articolo Install an older version of Firefox e scaricare la stessa versione 45 per il nostro sistema operativo dall’archivio ufficiale di Mozilla:

    La versione per GNU/Linux è direttamente funzionante una volta estratti i file dall’archivio compresso. È tuttavia necessario creare un diverso profilo utente, analogamente alla versione predisposta da ICCD. In questo profilo utente sarà anche salvata l’opzione di disattivare gli aggiornamenti, che dobbiamo limitare al solo Firefox per SIGECweb.

    Il modo più semplice per creare il nuovo profilo utente è eseguire Firefox dal terminale dalla directory dove è stato scaricato:

    » ./firefox -P
    Schermata dell’archivio con la versione 45.9.0 di Firefox
    La finestra di selezione del profilo utente. Da qui, solo la prima volta, dobbiamo creare il nuovo profilo SIGECweb e deselezionare la voce “Utilizza il profilo selezionato senza chiedere all’avvio”.

    Una volta creato il profilo utente dedicato, è necessario disattivare gli aggiornamenti automatici, che purtroppo non possiamo installare. Visto che è importantissimo mantenere aggiornata la versione di uso generale, l’uso di due profili separati ci permette di limitare questa disattivazione alla versione “parallela” dedicata a SIGECweb.

    Adesso siamo pronti per continuare a usare il normale Firefox (debitamente aggiornato alla versione più recente!) per tutte le nostre attività, riservando la versione 45 a SIGECweb.

    Chiudiamo tutte le finestre di Firefox, e poi apriamo nuovamente la versione normale. A questo punto comparirà nuovamente la finestra di selezione del profilo: possiamo riattivare l’utilizzo del profilo utente default senza chiedere all’avvio della versione Firefox normale, mentre useremo il profilo “SIGECweb” in modo dedicato avviando dal terminale.

    Ripristinare il profilo di default per la versione aggiornata di Firefox.

    Sempre dalla directory dove è stata scaricata la versione 45, possiamo usare questo comando:

    » ./firefox -P SIGECweb --no-remote

    L’opzione -P indica quale profilo caricare (senza far comparire la finestra di scelta) mentre l’opzione --no-remote permette di eseguire in parallelo entrambe le versioni di Firefox senza che quella dedicata a SIGECweb prenda il sopravvento.

    Ora possiamo dedicarci alla catalogazione di beni culturali anche se il nostro sistema operativo non è Windows.

  • I libri che ho letto nel 2018

    I libri che ho letto nel 2018

    Nel 2018 ho fatto una scelta piuttosto originale per guidare le mie letture: ho recuperato a casa dei miei genitori un pacco di libri rimasti impilati negli ultimi anni, generalmente arrivati in regalo, che per qualche motivo non mi ero mai portato via. Libri che non avevo letto, ecco. Libri che avevo dimenticato di leggere. Uno magari potrebbe decidere di leggere solo una certa autrice per tutto l’anno, solo libri pubblicati nel 1965, o qualche criterio del genere.

    Ho finito la pila di libri non letti e poi mi sono tuffato dentro 4 3 2 1 come una lontra nel fiume.

    Daniele De Silva, Non avevo capito niente

    Questo non era rimasto impilato ma mi ha dato l’idea di una annata a tema. Un po’ sconnesso nell’incedere ma è stata una bella lettura, forse troppo veloce.

    Annamaria Fassio, I giorni del Minotauro

    Un giallo piemontese edito da Frilli. Ben architettato e ambientato.

    Chinua Achebe, Non più tranquilli

    Se con Le cose crollano eravamo di fronte alla tragedia di una società antica, di un suo protagonista inizialmente invincibile, il salto di due generazioni ci porta in un tempo dell’Africa quasi contemporaneo, eppure ancora legato a quella società antica, ai suoi legami indissolubili da cui è difficile sciogliersi anche per chi è apparentemente molto brillante.

    Antonio Pennacchi, Canale Mussolini

    A me Canale Mussolini non è piaciuto. Ho faticato per leggerlo. Ho sperato a lungo che abbandonasse la prosa dal fare omerico via via che la storia si dipanava, ripetendosi sempre uguale, e invece niente. Ci ho sperato un po’ perché varie persone erano rimaste entusiaste. Di sicuro è scritto per conquistare il lettore. Di sicuro non avevo mai letto una giustificazione così lunga del fascismo, così assolutoria per chi ne è stato protagonista al minuto e così, diciamo, controversa nella figura del narratore. È difficile sospendere il giudizio mentre si legge questa epopea familiare fatta di personaggi tragici, immobili.

    Come dice, scusi? Canale Mussolini avrebbe vinto il Premio Strega e io non capisco un’acca della letteratura italiana contemporanea? Ma io sto unicamente raccontando il libro come l’ho trovato io, che guarda caso poi risulta scritto da un prete, e sempre quest’anno mi son trovato con un altro illustre premiato ancor più penoso, e in fin dei conti se per far rinascere l’epica italiana dobbiamo sorbirci un revisionismo palloso e ripetitivo, allora lasciamola nella tomba. Questa è la mia versione dei fatti, poi vedete voi e andate in malora.

    Enrico Giannichedda, Quasi giallo

    Non conosco molti archeologi che scrivono gialli (ad eccezione, forse, di Fred Vargas che non è proprio un’archeologa). Quindi non sono preoccupato di dire che questo quasi giallo non mi è piaciuto moltissimo. Forse perché le parti archeologiche, che abbondano e quasi debordano, mi sono note in buon dettaglio sia per studio sia per averle sentite proprio dalla voce di Enrico Giannichedda, e in questa cornice sembrano paradossalmente meno interessanti. Forse perché le parti gialle sono abbastanza solidamente nel solco del genere, senza però essere veramente nel solco giallo della copertina, magari più noir o 10YR 2/1. Altri che hanno letto il libro non sono rimasti soddisfatti dal finale, che però tutto sommato a me piace.

    Michele Serra, Ognuno potrebbe

    Michele Serra è un membro di quella categoria di persone che svolgono il meschino dovere di partorire ogni giorno un pensierino da scolaro delle elementari per la pubblica fruizione. La forma libresca non migliora l’esito e questa storia di un precario, scritta da uno che il precario non sa nemmeno recitarlo sotto forma di macchietta, non piace proprio.

    Timur Vermes, Lui è tornato

    Tanto inquietante (oggi ancora più di quando è stato scritto, solo nel 2011) quanto scopppiettante, questo è il libro che più mi è piaciuto leggere nel 2018, carico di continui rilanci che solo un buonsenso ormai intorpidito può considerare assurdi. Non ho visto il film che ne è stato tratto, in cui il protagonista non è Hitler bensì Mussolini, ma ne ho parlato con alcuni che lo hanno visto: il discorso è andato a parare sul “messaggio” che l’autore trasmette. Io penso che sia un messaggio molto implicito, che l’autore abbia saputo mostrare in modo eccellente come funzionano, come possono funzionare certi meccanismi psicologici e sociali che hanno conseguenze rapidamente irreparabili, senza bisogno di manifestare una “ovvia” valutazione negativa che avrebbe reso molto meno incisivo il suo autentico messaggio. In ogni caso, lui è tornato già parecchie volte negli ultimi anni e sembra che non siano state vendute abbastanza copie di questo libro.

    Edoardo Nesi, Storia della mia gente

    Chi abbia dato un premio a questo libro, dovrebbe almeno giustificare il vistoso errore grammaticale del titolo, poiché questa è una storia individuale e solipsistica, vissuta e narrata alla prima persona singolare, da parte di un autore che, del suo passato rimpianto da rampollo fallito di famiglia operosa, ricorda i nomi propri dei macchinari (femminili, ovviamente) ma non quelli degli operai. Uno che dedica varie pagine al Martini nell’ambito del tracollo economico della piccola media impresa manifatturiera italiana. Uno che è felice di scendere in piazza a manifestare perché lo fa stare bene.

    Il motivo del blasone è presto detto, essendo l’autore stato precedentemente inserito nella shortlist ha deciso di titillare il premio stesso con continui rimandi ad esso, rendendolo (immaginiamo a propria insaputa) co-protagonista di questa farsa che sa rendersi lucida solo in forma onirica – rivelandosi anche genuinamente impregnata di razzismo.

    Paul Auster, 4 3 2 1

    Questo libro, questi libri, sono anzitutto una smisurata forma di devozione, una lunghissima dichiarazione d’amore verso la scrittura e la letteratura, verso New York e Parigi e forse anche verso l’essere ebrei negli Stati Uniti. Non per caso la prima parte mi ha ricordato fortissimamente Middlesex, così come il rimando continuo tra storia personale e storia collettiva, non un semplice sfondo ma un palcoscenico.

    Il volume è imponente e ha richiesto una certa disciplina nella lettura, evitando tassativamente di leggere più di un capitolo al giorno per non andare in confusione, ma la trama è certo uno degli elementi meno portanti del capolavoro, come prevedibile. Trama che è composta anche di frammenti, mattoni autobiografici composti in modi sempre diversi.

    Ci sono capoversi lunghissimi che vorresti non finissero mai. Ci sono liste, ma che liste, di libri, di film, di poesie, di musica. C’è tantissimo sesso, muoiono molte persone e sono sempre le stesse persone i personaggi che vivono 4, 3, 2 vite leggermente o completamente diverse dall’una che tiene il filo.

    Si ride, si gode e si soffre moltissimo con questo libro.

    Paolo Lazzarin, Patagonia

    Questo che mi ha regalato Elisa il 26 dicembre è un delizioso resoconto fotografico di viaggio. La Patagonia, al di là delle frasi da guida turistica, è difficile da spiegare, e la vastità degli spazi soverchia la vista, la mente. Questo viaggio si è svolto principalmente lungo la catena andina, via terra in direzione sud e via mare in direzione nord. Il nostro viaggio, più spezzato e incoerente, era stato certamente meno lento ma comunque sfogliando le pagine ho ritrovato quelle montagne, quelle strade e quei guanachi — perché poi sono uno dei compagni di viaggio più memorabili. Grazie.


    Nel 2019 ho deciso che leggerò solo libri scritti da autrici.

  • I libri che ho letto nel 2017

    I libri che ho letto nel 2017

    Quest’anno mi porto avanti di qualche settimana rispetto al ritardo astronomico maturato negli anni e pubblico la lista dei pochi libri che ho letto nel 2017.

    Il 2017 è stato l’anno in cui sono diventato papà, in cui ho traslocato dalla città dove è nato mio figlio a quella dove sono nato io ma dove non avevo quasi mai abitato, in cui ho cambiato lavoro per poter finalmente continuare a fare il mio mestiere. Quindi, scusate se ho letto troppo poco. Anche nel 2017 non ho letto nessun libro che non fosse scritto in italiano (mica intenzionalmente).

    Ho anche iniziato a tenere traccia dei libri su inventaire.io.

    Piero Colaprico, Trilogia della città di M.

    Questo libro mi è stato donato da Stefano R., nativo della città di M., quando ho iniziato a lavorare nella città di M. il 13 dicembre 2017. L’ho consumato nei vagoni ferroviari prima dell’alba e dopo il tramonto viaggiando quotidianamente da Genova.

    Le tre storie in cui si muove l’ispettore Bagni sono ambientate in una città di mezzo, tra quella vecchia che sta scomparendo e lascia il tempo ad una nuova. Muovendomi nella zona del Ticinese più volte ho provato la sensazione di essere stato in quei luoghi. Non sono un assiduo frequentatore della letteratura di genere, ma se leggo un poliziottesco, ora preferisco Bagni ai suoi colleghi più televisivi.

    Wu Ming 1, Un viaggio che non promettiamo breve

    Ho iniziato a leggere questo libro verso fine anno, proprio come la Trilogia ad inizio articolo, viaggiando in treno lungo uno dei percorsi che dovrebbero essere toccati dalle Grandi Opere. E poiché il libro racconta con estrema precisione la realtà, ho faticato ad ogni pagina a reggere il peso di tutte le nefandezze, e per adesso non ho letto che un terzo del libro, forse un po’ meno.

    È un libro che deve essere letto, perché è una storia che non è ancora conclusa e da queste parti oltre alla inutile e dannosa TAV abbiamo un altrettanto inutile terzo valico ferroviario, mentre le linee ferroviarie già esistenti del pendolarismo quotidiano sono in frantumi.

    Edmund De Waal, La strada bianca

    Questo è un libro di cui mi sono innamorato vedendo la copertina in vetrina nella mia libreria. A me piacciono le copertine che raccontano qualcosa del libro, e questa era già di per sé meritevole di essere portata a casa, anche se non ci fosse stato il libro dentro.

    Ho letto il primo capitolo con l’emozione di chi scopre un tesoro. L’ho dovuto persino rileggere a voce alta, per poterlo capire in tutta la sua poesia. Questo libro è stato compagno di viaggio tra la fine del 2016 e l’inizio del 2017.}

    Non ho mai letto Un’eredità di avorio e ambra, che pure è sulla libreria di casa da anni. Non avevo capito bene di cosa si trattasse, potrei dire.

    Per me la ceramica, e quindi anche la porcellana, è un elemento primordiale a cui ho dedicato moltissima parte della mia vita adulta, soprattutto manipolando, guardando, osservando migliaia di vasi rotti. Leggerne una storia raccontata in prima persona è stato un percorso di ricucitura, una forma di kintsugi letterario.

    Marco Danielli, Uscita di sicurezza

    Marco è prima di tutto un collega, che potrebbe sembrare molto versatile, vista la varietà di ruoli che ha rivestito nella vita in situazioni molto diverse. È stata una grande sorpresa scoprire che è anche un abile scrittore.

    Un romanzo d’esordio finemente costruito che combina realtà autobiografica e finzione letteraria.

    Igiaba Scego, Adua

    Non so se i quattro lettori assidui di questa rubrica ci hanno fatto caso, ma da qualche anno leggo sempre almeno un libro di Africa. Quest’anno, addirittura due.

    Leggere di Africa è inevitabilmente una seduta di colonialismo, di post-colonialismo, oltre che di un continente non misurabile, privo di significato a meno di non essere distorto da una proiezione geografica sbagliata. Nel caso clinico italiano credo si possa parlare a buon diritto di post-colonialismo assente – autrici come Igiaba Scego sono ogni giorno lì a smontare il buonismo, soprattutto con storie come quella di Adua, ben più di un romanzo storico.

    Chinua Achebe, Le cose crollano

    Ricevuto in dono e letto con gusto, questo primo libro della trilogia è un gioiello di grande profondità storica e soprattutto epica. Achebe muove e colpisce i suoi personaggi con l’eleganza di un vero classico. Leggendo è stato impossibile non rispecchiarsi nelle pagine di Congo, così totalmente diverso eppure intrecciato nelle stesse vicende storiche.

  • IOSACal on the web: quick calibration of radiocarbon dates

    IOSACal on the web: quick calibration of radiocarbon dates

    Update November 2022: the web app is now discontinued and the recommended way to run IOSACal in the browser is with Jupyter in MyBinder or Google Colab. See this issue for more details.

    The IOSA Radiocarbon Calibration Library (IOSACal) is an open source calibration software. IOSACal is meant to be used from the command line and installation, while straightforward for GNU/Linux users, is certainly not as easy as common desktop apps. To overcome this inconvenience, I dedicated some efforts to develop a version that is immediately usable.

    The IOSACal web app is online at https://iosacal.herokuapp.com/.

    This is a demo service, so it runs on the free tier of the commercial Heroku platform and it may take some time to load the first time you visit the website. It is updated to run with the latest version of the software (at this time, IOSACal 0.4.1, released in May).

    Since it may be interesting to try the app even if you don’t have a radiocarbon date at hand, at the click of a button you can randomly pick one from the open data Mediterranean Radiocarbon dates database, and the form will be filled for you.

    The random date picker in action
    The random date picker in action

    Unfortunately, at this time it is not possible to calibrate or plot multiple dates in the web interface (but the command-line program is perfectly capable of that).

    IOSACal Web is made with Flask and the Bootstrap framework, and the app itself is of course open source.

    IOSACal is written in the Python programming language and is based on Numpy, Scipy and Matplotlib. This work wouldn’t be possible without the availability of such high quality programming libraries.

  • IOSACal 0.4

    IOSACal 0.4

    IOSACal is an open source program for calibration of radiocarbon dates.

    A few days ago I released version 0.4, that can be installed from PyPI or from source. The documentation and website is at http://c14.iosa.it/ as usual. You will need to have Python 3 already installed.

    The main highlight of this release are the new classes for summed probability distributions (SPD) and paleodemography, contributed by Mario Gutiérrez-Roig as part of his work for the PALEODEM project at IPHES.

    A bug affecting calibrated date ranges extending to the present was corrected.

    On the technical side the most notable changes are the following:

    • requires NumPy 1.14, SciPy 1.1 and Matplotlib 2.2
    • removed dependencies on obsolete functions
    • improved the command line interface

    You can cite IOSACal in your work with the DOI https://doi.org/10.5281/zenodo.630455. This helps the author and contributors to get some recognition for creating and maintaining this software free for everyone.

  • I libri che ho letto nel 2016

    I libri che ho letto nel 2016

    Diciamo subito che nel 2016 ho letto poco e male, e diamo la responsabilità al fatto che nella prima parte dell’anno invece ho scritto un po’ (abbastanza da concludere la mia tesi di dottorato, tanto per capirci), mentre nella seconda parte dell’anno ho dedicato del tempo allo studio per un concorso (che poi è andato bene).

    Aggiungiamo che poco dopo la fine del 2016, come alcune delle letture suggeriscono, sono diventato papà, e ho aiutato come potevo la mamma con il suo pancione, invece che leggere (tranne un caso in cui ho letto per loro molte volte lo stesso libro ad alta voce).

    • James Ellroy, Perfidia è il mio preferito e mi ha fatto trovare vecchie mappe di Los Angeles (il massimo)
    • Wu Ming, L’invisibile ovunque
    • Joe R. Lansdale, Rumble Tumble che mi ha passato Andrea Bellotti e non glielo ho ancora reso
    • Roberto Negro, Bocca di rosa
    • Loredana Lipperini, Ancora dalla parte della bambine
    • Julien Blanc-Gras, Padri in attesa. Il giornale di bordo di un padre nella Terra della gravidanza
    • Chiara Cecilia Santamaria, Quello che le mamme non dicono
    • Emma Mora, L’orsacchiotto Gedeone (qualche dozzina di volte)

  • Numbering boxes of archaeological items, barcodes and storage management

    Numbering boxes of archaeological items, barcodes and storage management

    Last week a tweet from the always brilliant Jolene Smith inspired me to write down my thughts and ideas about numbering boxes of archaeological finds. For me, this includes also thinking about the physical labelling, and barcodes.

    https://twitter.com/aejolene/status/837466518166331393

    The question Jolene asks is: should I use sequential or random numbering? To which many answered: use sequential numbering, because it bears significance and can help detecting problems like missing items, duplicates, etc. Furthermore, if the number of items you need to number is small (say, a few thousands), sequential numbering is much more readable than a random sequence. Like many other archaeologists faced with managing boxes of items, I have chosen to use sequential numbering in the past. With 200 boxes and counting, labels were easily generated and each box had an associated web page listing the content, with a QR code providing a handy link from the physical label to the digital record. This numbering system was put in place during 3 years of fieldwork in Gortyna and I can say that I learned a few things in the process. The most important thing is that it’s very rare to start from scratch with the correct approach: boxes were labeled with a description of their content for 10 years before I adopted the numbering system pictured here. This sometimes resulted in absurdly long labels, easily at risk of being damaged, difficult to search since no digital recording was made. I decided a numbering system was needed because it was difficult to look for specific items, after I had digitised all labels with their position in the storage building (this often implied the need to number shelves, corridors, etc.). The next logical thing was therefore to decouple the labels from the content listing ‒ any digital tool was good here, even a spreadsheet. Decoupling box number from description of content allowed to manage the not-so-rare case of items moved from one box to another (after conservation, or because a single stratigraphic context was excavated in multiple steps, or because a fragile item needs more space …), and the other frequent case of data that is augmented progressively (at first, you put finds from stratigraphic unit 324 in it, then you add 4.5 kg of Byzantine amphorae, 78 sherds of cooking jars, etc.). Since we already had a wiki as our knowledge base, it made sense to use that, creating a page for each box and linking from the page of the stratigraphic unit or that of the single item to the box page (this is done with Semantic MediaWiki, but it doesn’t matter). Having a URL for each box I could put a QR code on labels: the updated information about the box content was in one place (the wiki) and could be reached either via QR code or by manually looking up the box number. I don’t remember the details of my reasoning at the time, but I’m happy I didn’t choose to store the description directly inside the QR code ‒ so that scanning the barcode would immediately show a textual description instead of redirecting to the wiki ‒ because that would require changing the QR code on each update (highly impractical), and still leave the information unsearchable. All this is properly documented and nothing is left implicit. Sometimes you will need to use larger boxes, or smaller ones, or have some items so big that they can’t be stored inside any container: you can still treat all of these cases as conceptual boxes, number and label them, give them URLs.

    QR codes used for boxes of archaeological items in Gortyna

    There are limitations in the numbering/labelling system described above. The worst limitation is that in the same building (sometimes on the same shelf) there are boxes from other excavation projects that don’t follow this system at all, and either have a separate numbering sequence or no numbering at all, hence the “namespacing” of labels with the GQB prefix, so that the box is effectively called GQB 138 and not 138. I think an efficient numbering system would be one that is applied at least to the scale of one storage building, but why stop there?

    Turning back to the initial question, what kind of numbering should we use? When I started working at the Soprintendenza in Liguria, I was faced with the result of no less than 70 years of work, first in Ventimiglia and then in Genoa. In Ventimiglia, each excavation area got its “namespace” (like T for the Roman theater) and then a sequential numbering of finds (leading to items identified as T56789) but a single continuous sequential sequence for the numbering of boxes in the main storage building. A second, newer building was unfortunately assigned a separate sequence starting again from 1 (and insufficient namespacing). In Genoa, I found almost no numbering at all, despite (or perhaps, because of) the huge number of unrelated excavations that contributed to a massive amount of boxes. Across the region, there are some 50 other buildings, large and small, with boxes that should be recorded and accounted for by the Soprintendenza (especially since most archaeological finds are State property in Italy). Some buildings have a numbering sequence, most have paper registries and nothing else. A sequential numbering sequence seems transparent (and allows some neat tricks like the German tanks problem), since you could potentially have an ordered list and look up each number manually, which you can’t do easily with a random number. You also get the impression of being able to track gaps in a sequence (yes, I do look for gaps in numeric sequences all the time), thus spotting any missing item. Unfortunately, I have been bitten too many times by sequential numbers that turned out to have horrible bis suffixes, or that were only applied to “standard” boxes leaving out oversized items.

    On the other hand, the advantages of random numbering seem to increase linearly with the number of separate facilities ‒ I could replace random with non-transparent to better explain the concept. A good way to look at the problem is perhaps to ask whether numbering boxes is done as part of a bookkeeping activity that has its roots in paper registries, or it is functional to the logistics of managing cultural heritage items in a modern and efficient way.

    Logistics. Do FedEx, UPS, Amazon employees care what number sequence they use to track items? Does the cashier at the supermarket care whether the EAN barcode on your shopping items is sequential? I don’t know, but I do know that they have a very efficient system in place, in which human operators are never required to actually read numerical IDs (but humans are still capable of checking whether the number on the screen is the same as the one printed on the label). There are many types of barcode used to track items, both 1D and 2D, all with their pros and cons. I also know of some successful experiments with RFID for archaeological storage boxes (in the beautiful depots at Ostia, for example), that can record numbers up to 38 digits.

    Based on all the reflections of the past years, my idea for a region- or state-wide numbering+labeling system is as follows (in RFC-style wording):

    1. it MUST use a barcode as the primary means of reading the numerical ID from the box label
    2. the label MUST contain both the barcode and the barcode content as human-readable text
    3. it SHOULD use a random numeric sequence
    4. it MUST use a fixed-length string of numbers
    5. it MUST avoid the use of any suffixes like a, b, bis

    In practice, I would like to use UUID4 together with a barcode.

    A UUID4 looks like this: 1b08bcde-830f-4afd-bdef-18ba918a1b32. It is the UUID version of a random number, it can be generated rather easily, works well with barcodes and has a collision probability that is compatible with the scale I’m concerned with ‒ incidentally I think it’s lower than the probability of human error in assigning a number or writing it down with a pencil or a keyboard. The label will contain the UUID string as text, and the barcode. There will be no explicit URL in the barcode, and any direct link to a data management system will be handled by the same application used to read the barcode (that is, a mobile app with an embedded barcode reader). The data management system will use UUID as part of the URL associated with each box. You can prepare labels beforehand and apply them to boxes afterwards, recording all the UUIDs as you attach the labels to the boxes. It doesn’t sound straightforward, but in practice it is.

    And since we’re deep down the rabbit hole, why stop at the boxes? Let’s recall some of the issues that I described non-linearly above:

    1. the content of boxes is not immutable: one day item X is in box Y, the next day it gets moved to box Z
    2. the location of boxes is not immutable: one day box Y is in room A of building B, the next day it gets moved to room C of building D
    3. both #1 and #2 can and will occur in bulk, not only as discrete events

    The same UUIDs can be applied in both directions in order to describe the location of each item in a large bottom-up tree structure (add as many levels as you see fit, such as shelf rows and columns):

    item X → box Y → shelf Z → room A → building B
    

    or:

    b68e3e61-e0e7-45eb-882d-d98b4c28ff31 → 3ef5237e-f837-4266-9d85-e08d0a9f4751
    3ef5237e-f837-4266-9d85-e08d0a9f4751 → 77372e8c-936f-42cf-ac95-beafb84de0a4
    77372e8c-936f-42cf-ac95-beafb84de0a4 → e895f660-3ddf-49dd-90ca-e390e5e8d41c
    e895f660-3ddf-49dd-90ca-e390e5e8d41c → 9507dc46-8569-43f0-b194-42601eb0b323
    

    Now imagine adding a second item W to the same box: since the data for item Y was complete, one just needs to fill one container relationship:

    b67a3427-b5ef-4f79-b837-34adf389834f → 3ef5237e-f837-4266-9d85-e08d0a9f4751
    

    and since we would have already built our hypothetical data management system, this data is filled into the system just by scanning two barcodes on a mobile device that will sync as soon as a connection is available. Moving one box to another shelf is again a single operation, despite many items actually moved, because the leaves and branches of the data tree are naïve and only know about their parents and children, but know nothing about grandparents and siblings.

    There are a few more technical details about data structures needed to have a decent proof of concept, but I already wrote down too many words that are tangential to the initial question of how to number boxes.

  • Total Open Station: a specialised format converter

    Total Open Station: a specialised format converter

    It’s 2017 and nine years ago I started writing a set of Python scripts that would become Total Open Station, a humble GPL-licensed tool to download and process data from total station devices. I started from scratch, using the Python standard library and pySerial as best as I could, to create a small but complete program. Under the hood, I’ve been “religiously” following the UNIX philosophy of one tool that does one thing well and that is embodied by the two command line programs that perform the separate steps of:

    1. downloading data via a serial connection
    2. converting the raw data to formats that can be used in GIS or CAD environments

    And despite starting as an itch to scratch, I also wanted TOPS to be used by others, to provide something that was absent from the free software world at the time, and that is still unchallenged in that respect. So a basic and ugly graphical interface was created, too. That gives a more streamlined view of the work, and largely increases the number of potential users. Furthermore, TOPS can run not just on Debian, Ubuntu or Fedora, but also on macOS and Windows and it is well known that users of the latter operating systems don’t like too much working from a terminal.

    Development has always been slow. After 2011 I had only occasional use for the software myself, no access to a real total station, so my interest shifted towards giving a good architecture to the program and extending the number of formats that can be imported and exported. In the process, this entailed rewriting the internal data structures to allow for more flexibility, such as differentiating between point, line and polygon geometries.

    Today, I still find GUI programming out of my league and interests. If I’m going to continue developing TOPS it’s for the satisfaction of crafting a good piece of software, learning new techniques in Python or maybe rewriting entirely in a different programming language. It’s clear that the core feature of TOPS is not being a workstation for survey professionals (since it cannot compete with the existing market of proprietary solutions that come attached to most devices), but rather becoming a polyglot converter, capable of handling dozens of raw data formats and flexibly exporting to good standard formats. Flexibly exporting means that TOPS should have features to filter data, to reproject data based on fixed base points with known coordinates, to create separate output files or layers and so on. Basically, to adapt to many more needs than it does now. From a software perspective, there are a few notable examples that I’ve been looking at for a long time: Sphinx, GPSBabel and Pandoc.

    Sphinx is a documentation generator written in Python, the same language I used for TOPS. You write a light markup source, and Sphinx can convert it to several formats like HTML, ePub, LaTeX (and PDF), groff. You can write short manuals, like the one I wrote for TOPS, or entire books. Sphinx accepts many options, mostly from a configuration file, and I took a few lines of code that I liked for handling the internal dictionary (key-value hash) of all input and output formats with conditional import of the selected module (rather than importing all modules that won’t be used). Sphinx is clearly excellent at what it does, even though the similarities with TOPS are not many. After all, TOPS has to deal with many undocumented raw formats while Sphinx has the advantage of only one standard format. Sphinx was originally written by Georg Brandl, one of the best Python developers and a contributor to the standard library, in a highly elegant object-oriented architecture that I’m not able to replicate.

    GPSBabel is a venerable and excellent program for GPS data conversion and transfer. It handles dozens of formats in read/write mode and each format has “suboptions” that are specific to it. GPSBabel has also advanced filtering capabilities, it can merge multiple input files and since a few years there is a minimal graphical interface. Furthermore, GPSBabel is integrated in GIS programs like QGIS and can work in a variety of ways thanks to its programmable command line interface. A strong difference with TOPS is that many of the GPS data formats are binary, and that the basic data structures of waypoints, tracks and routes is essentially the same (contrast that with the monster LandXML specification, or the dozens of possible combinations in a Leica GSI file). GPSBabel is written in portable C++, that I can barely read, so anything other than inspiration for the user interface is out of question.

    Pandoc is a universal document converter that reads many markup document formats and can convert to a greater number of formats including PDF (via LaTeX), docx, OpenDocument. The baseline format for Pandoc is an enriched Markdown. There are two very interesting features of Pandoc as a source of inspiration for a converter: the internal data representation and the Haskell programming language. The internal representation of the document in Pandoc is an abstract syntax tree that is not necessarily as expressive as the source format (think of all the typography and formatting in a printed document) but it can be serialised to/from JSON and allows filters to work regardless of the input or output format. Haskell is a functional language that I have never programmed, although it lends to creating complex and efficient programs that are easily extended. Pandoc works from the command line and has a myriad of options – it’s also rather common to invoke it from Makefiles or short scripts since one tends to work iteratively on a document. I could see a future version of TOPS being rewritten in Haskell.

    Scriptability and mode of use seem both important concepts to keep in mind for a data converter. For total stations, a common workflow is to download raw data, archive the original files and then convert to another format (or even insert directly into a spatial database). With the two programs totalopenstation-cli-connector and totalopenstation-cli-parser such tasks are easily automated in a single master script (or batch procedure) using a timestamp as identifier for the job and the archived files. This means that once the right parameters for your needs are found, downloading, archiving and loading survey data in your working environment is a matter of seconds, with no point-and-click, no icons, no mistakes. Looking at GPSBabel, I wonder whether keeping the two programs separate really makes sense from a UX perspective, as it would be more intuitive to have a single totalopenstation executable. In fact, this dual approach is a direct consequence of the small footprint of totalopenstation-cli-connector, that merely acts as a convenience layer on top of pySerial.

    It’s also important to think about maintainability of code: I have little interest in developing the perfect UI for TOPS, all the time spent for development is removed from my spare time (since no one is paying for TOPS) and it would be way more useful if dedicated plugins existed for popular platforms (think QGIS, gvSIG, even ArcGIS supports Python, not to mention CAD software). At this time TOPS supports ten (yes, 10) input formats out of … hundreds, I think (some of which are proprietary, binary formats). Expanding the list of supported formats is the single aim that I see as reasonable and worth of being pursued.