Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change IOP indexing to letters #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 104 additions & 56 deletions MakeAuthorLists.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 395,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 396,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 397,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -128,29 +128,29 @@
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>103</th>\n",
" <td>Trettin</td>\n",
" <th>106</th>\n",
" <td>Us\\'on</td>\n",
" <td>A.</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Department of Physics and Astronomy, Mancheste...</td>\n",
" <td>Manchester. M13 9PL, United Kingdom</td>\n",
" <td>Instituto de F\\'isica Corpuscular (IFIC), CSIC...</td>\n",
" <td>Paterna, E-46980, Spain</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>104</th>\n",
" <td>Us\\'on</td>\n",
" <td>A.</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Instituto de F\\'isica Corpuscular (IFIC), CSIC...</td>\n",
" <td>Paterna, E-46980, Spain</td>\n",
" <th>107</th>\n",
" <td>Valle</td>\n",
" <td>P.R.G.</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Donostia International Physics Center, BERC Ba...</td>\n",
" <td>San Sebasti\\'an / Donostia, E-20018, Spain</td>\n",
" <td>Department of Applied Chemistry, Universidad d...</td>\n",
" <td>San Sebasti\\'an / Donostia, E-20018, Spain</td>\n",
" </tr>\n",
" <tr>\n",
" <th>105</th>\n",
" <th>108</th>\n",
" <td>Veloso</td>\n",
" <td>J.F.C.A.</td>\n",
" <td>NaN</td>\n",
Expand All @@ -161,7 +161,7 @@
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>106</th>\n",
" <th>109</th>\n",
" <td>Waiton</td>\n",
" <td>J.</td>\n",
" <td>NaN</td>\n",
Expand All @@ -172,7 +172,7 @@
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>107</th>\n",
" <th>110</th>\n",
" <td>Yubero</td>\n",
" <td>A.</td>\n",
" <td>NaN</td>\n",
Expand All @@ -184,7 +184,7 @@
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>106 rows × 8 columns</p>\n",
"<p>109 rows × 8 columns</p>\n",
"</div>"
],
"text/plain": [
Expand All @@ -195,11 +195,11 @@
"5 Aparicio B. NaN NaN \n",
"6 Aranburu A.I. NaN NaN \n",
".. ... ... ... ... \n",
"103 Trettin A. NaN NaN \n",
"104 Us\\'on A. NaN NaN \n",
"105 Veloso J.F.C.A. NaN NaN \n",
"106 Waiton J. NaN NaN \n",
"107 Yubero A. NaN NaN \n",
"106 Us\\'on A. NaN NaN \n",
"107 Valle P.R.G. NaN NaN \n",
"108 Veloso J.F.C.A. NaN NaN \n",
"109 Waiton J. NaN NaN \n",
"110 Yubero A. NaN NaN \n",
"\n",
" Institution1 \\\n",
"2 Argonne National Laboratory \n",
Expand All @@ -208,29 +208,55 @@
"5 Department of Organic Chemistry I, University ... \n",
"6 Donostia International Physics Center, BERC Ba... \n",
".. ... \n",
"103 Department of Physics and Astronomy, Mancheste... \n",
"104 Instituto de F\\'isica Corpuscular (IFIC), CSIC... \n",
"105 Institute of Nanostructures, Nanomodelling and... \n",
"106 Department of Physics and Astronomy, Mancheste... \n",
"106 Instituto de F\\'isica Corpuscular (IFIC), CSIC... \n",
"107 Donostia International Physics Center, BERC Ba... \n",
"108 Institute of Nanostructures, Nanomodelling and... \n",
"109 Department of Physics and Astronomy, Mancheste... \n",
"110 Donostia International Physics Center, BERC Ba... \n",
"\n",
" Address1 \\\n",
"2 Argonne, IL 60439, USA \n",
"3 Manchester. M13 9PL, United Kingdom \n",
"4 Valencia, E-46022, Spain \n",
"5 San Sebasti\\'an / Donostia, E-20018, Spain \n",
"6 San Sebasti\\'an / Donostia, E-20018, Spain \n",
".. ... \n",
"106 Paterna, E-46980, Spain \n",
"107 San Sebasti\\'an / Donostia, E-20018, Spain \n",
"108 Aveiro, 3810-193, Portugal \n",
"109 Manchester. M13 9PL, United Kingdom \n",
"110 San Sebasti\\'an / Donostia, E-20018, Spain \n",
"\n",
" Address1 Institution2 Address2 \n",
"2 Argonne, IL 60439, USA NaN NaN \n",
"3 Manchester. M13 9PL, United Kingdom NaN NaN \n",
"4 Valencia, E-46022, Spain NaN NaN \n",
"5 San Sebasti\\'an / Donostia, E-20018, Spain NaN NaN \n",
"6 San Sebasti\\'an / Donostia, E-20018, Spain NaN NaN \n",
".. ... ... ... \n",
"103 Manchester. M13 9PL, United Kingdom NaN NaN \n",
"104 Paterna, E-46980, Spain NaN NaN \n",
"105 Aveiro, 3810-193, Portugal NaN NaN \n",
"106 Manchester. M13 9PL, United Kingdom NaN NaN \n",
"107 San Sebasti\\'an / Donostia, E-20018, Spain NaN NaN \n",
" Institution2 \\\n",
"2 NaN \n",
"3 NaN \n",
"4 NaN \n",
"5 NaN \n",
"6 NaN \n",
".. ... \n",
"106 NaN \n",
"107 Department of Applied Chemistry, Universidad d... \n",
"108 NaN \n",
"109 NaN \n",
"110 NaN \n",
"\n",
" Address2 \n",
"2 NaN \n",
"3 NaN \n",
"4 NaN \n",
"5 NaN \n",
"6 NaN \n",
".. ... \n",
"106 NaN \n",
"107 San Sebasti\\'an / Donostia, E-20018, Spain \n",
"108 NaN \n",
"109 NaN \n",
"110 NaN \n",
"\n",
"[106 rows x 8 columns]"
"[109 rows x 8 columns]"
]
},
"execution_count": 3,
"execution_count": 397,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -241,7 +267,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 398,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -262,7 +288,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 399,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -280,7 +306,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 400,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -329,38 +355,60 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 401,
"metadata": {},
"outputs": [],
"source": [
"# Function to make the author list for IOP journals (JCAP, JHEP, JINST...)\n",
"# Function to convert the institution index to a letter for IOP format\n",
"def index_to_letter(input_string):\n",
"\n",
" # Split the input string by commas and remove empty strings\n",
" numbers_str = [num for num in input_string.split(',') if num]\n",
"\n",
" # Map each number to its corresponding alphabet letter\n",
" letters = [chr(ord('a') + int(num) - 1) for num in numbers_str]\n",
"\n",
" # Format the string\n",
" string = \"\"\n",
" for a in letters:\n",
" string = string+a+\",\"\n",
"\n",
" return string\n",
"\n",
"\n",
"# Function to make the author list for IOP journals (JCAP, JHEP, JINST...)\n",
"def MakeIOPAuthorList():\n",
"\n",
" authorlist=str()\n",
" UsedNotes=defaultdict(int)\n",
" for a in OrderOfAuthors:\n",
" entry=dat.loc[a]\n",
" instids=\"\"\n",
" instids_letter=\"\"\n",
" noteids=\"\"\n",
" notestring=\"\"\n",
" for InstCol in InstColumns:\n",
" if(entry.notna()[InstCol]):\n",
" instids+=InstitutionID(entry[InstCol])+\",\"\n",
" instids_letter = index_to_letter(instids)\n",
" if(len(str(entry.Footnote))>5):\n",
" nid=NoteID(entry.Footnote)\n",
" nid = str(ord(nid) - ord('a') + 1) # convert to a letter\n",
" noteids+=\",\"+nid\n",
" if(UsedNotes[nid]==False):\n",
" notestring+=\"\\\\note[\"+nid+\"]{\" + entry.Footnote + \"}\"\n",
" UsedNotes[nid]=UsedNotes[nid]+1\n",
" \n",
" authorlist+=(\"\\\\author[\"+instids[:-1]+noteids+\"]{\"+entry.Initial.strip()+\"~\"+entry.LastName.strip()+notestring+\",}\\n\")\n",
" authorlist+=(\"\\\\author[\"+instids_letter[:-1]+noteids+\"]{\"+entry.Initial.strip()+\"~\"+entry.LastName.strip()+notestring+\",}\\n\")\n",
" authorlist+=(\"%\\n\")\n",
" authorlist+=(\"%\\n\")\n",
"\n",
" authorlist+=(\"%\\n\")\n",
" for i in range(0,len(UniqueInstitutions)):\n",
" authorlist+=\"\\\\affiliation[\" + str(InstitutionID(UniqueInstitutions[i])) + ']{\\n' + UniqueInstitutions[i].replace('\\\\\\\\','\\\\\\\\\\n')+\", \"+Addresses[i]+\"}\\n\"\n",
" # Convert the institution ID to a letter\n",
" Institution_Letter = index_to_letter(InstitutionID(UniqueInstitutions[i]))\n",
"\n",
" authorlist+=\"\\\\affiliation[\" + str(Institution_Letter[:-1]) + ']{\\n' + UniqueInstitutions[i].replace('\\\\\\\\','\\\\\\\\\\n')+\", \"+Addresses[i]+\"}\\n\"\n",
" authorlist+=(\"%\\n\")\n",
" for email in CorrespondingEmails:\n",
" authorlist+=\"\\emailAdd{\"+email+\"}\\n\"\n",
Expand All @@ -370,7 +418,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 402,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -409,7 +457,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 403,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -446,7 +494,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 404,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -472,7 +520,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 405,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -490,7 +538,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 406,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -512,7 +560,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 407,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -546,7 +594,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 408,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -601,7 +649,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.8"
"version": "3.10.2"
}
},
"nbformat": 4,
Expand Down
Loading