LiberTEM/LiberTEM

View on GitHub
scripts/creatorlist.ipynb

Summary

Maintainability
Test Coverage
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "from IPython.core.display import display, HTML"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "creators_file = '../packaging/creators.json'\n",
    "with open(creators_file, 'r', encoding='utf-8') as f:\n",
    "    creators = json.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "affiliations = []\n",
    "authordescs = []\n",
    "\n",
    "for entry in creators:\n",
    "    try:\n",
    "        affiliation = entry['affiliation']\n",
    "        if affiliation not in affiliations:\n",
    "            affiliations.append(affiliation)\n",
    "        index = affiliations.index(affiliation)\n",
    "    except KeyError:\n",
    "        index = -1\n",
    "    authordescs.append((entry['displayname'], index))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<p>Alexander Clausen<sup>1</sup>, Dieter Weber<sup>1</sup>, Karina Ruzaeva<sup>1</sup>, Vadim Migunov<sup>2</sup>, Anand Baburajan<sup>3</sup>, Abijith Bahuleyan<sup>4</sup>, Jan Caron<sup>1</sup>, Rahul Chandra<sup>5</sup>, Shankhadeep Dey<sup>6</sup>, Magnus Nord<sup>7</sup>, Colin Ophus<sup>8</sup>, Simon Peter, Jay van Schyndel<sup>9</sup>, Jaeweon Shin<sup>10</sup>, Knut Müller-Caspary<sup>1</sup>, Rafal E. Dunin-Borkowski<sup>1</sup></p><p><sup>1</sup>Jülich Research Centre, Ernst Ruska Centre<br/><sup>2</sup>RWTH Aachen University, Jülich Research Centre, Ernst Ruska Centre<br/><sup>3</sup>APJ Abdul Kalam Technological University<br/><sup>4</sup>APJ Abdul Kalam Technical University<br/><sup>5</sup>Chandigarh University<br/><sup>6</sup>Siliguri Institute of Technology<br/><sup>7</sup>University of Antwerp<br/><sup>8</sup>Lawrence Berkeley National Laboratory<br/><sup>9</sup>Monash University eResearch Centre<br/><sup>10</sup>ETH Zürich</p>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "authorstrings = []\n",
    "affiliationstrings = []\n",
    "\n",
    "for a in authordescs:\n",
    "    authorstring = a[0]\n",
    "    if a[1] >= 0:\n",
    "        authorstring = f'{authorstring}<sup>{a[1] + 1}</sup>'\n",
    "    authorstrings.append(authorstring)\n",
    "\n",
    "for index, affiliation in enumerate(affiliations):\n",
    "    affiliationstrings.append(f'<sup>{index + 1}</sup>{affiliation}')\n",
    "\n",
    "display(HTML(f'<p>{\", \".join(authorstrings)}</p><p>{\"<br/>\".join(affiliationstrings)}</p>'))"
   ]
  },
  {
   "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.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}