ATLAS hacks
Preparing plots for ATLAS publication
All ATLAS plots used for the circulation inside the collaboration must have the “ATLAS Internal” label if you use data or “ATLAS Simulation Internal” if you use only simulation. However, when preparing plots for publication outside the collaboration, the label “Internal” must be removed for papers, replaced with “Preliminary” for CONF or PUB notes, or replaced with “Work in progress” for thesis/regional conferences. Instead of manually recreating all PDF plots, where you only change the label, you can use the following code to automate the process for an existing PDF plot.
pip install -U pymupdf
import pymupdf
file_path = "figures/extracted_gluon.pdf"
save_path = "tmp/extracted_gluon_redacted.pdf"
doc = pymupdf.open(file_path)
needle = "Internal"
for page in doc:
res = page.search_for(needle)
for r in res:
page.add_redact_annot(r, text=None)
page.apply_redactions()
doc.save(save_path)