Writing Scientific Reports on Computational Projects

Project 4 is your final assessment for this course (40% of your grade). The goal will be to

In this workshop, we focus on the report writing aspect in the specific context of a computational project.

You will be provided with a template both in Microsoft Word and LaTeX. The LaTeX template is more suitable for a scientific report, but the Word template is more user-friendly for those new to LaTeX.

In this workshop, we will introduce you to:

Main structure of a report on a computational project

A report is a brief, structured document that explains the motivation, the methods, the results, and the conclusions of a project.

Its focus is on clarity, purpose and rigour. You can think of this as a first draft of a scientific paper, but without the need for a comprehensive literature review or a detailed discussion of related work. The emphasis is on the methodology and the results.

For your report, we will provide you with a template that includes the following sections:

  • Title: A concise and informative title that reflects the content of your report.

  • Abstract: This a extremely brief summary, usually no more than 100-150 words, that gives a quick overview of the problem, the methods, the results, and the conclusions.

  • Introduction: In this section you want to contextualise your problem, providing motivation and background. You want to answer the following questions:

  • What kind of problem are we looking at?

  • Why does this matter?

  • What are we trying to achieve?

It can be useful to briefly outline your roadmap to the reader, so they know what to expect in the rest of the report.

  • Methodology: Here you prepare the reader with the necessary information to understand your approach. This means that here you will define all the quantities of interest that will be tracked in your results section, and you will explain the rationale behind your choices. You want to answer questions such as:

  • What data are we using?

  • What quantities are we tracking?

  • What specific scientific question or hypothesis are we trying to answer or validate with such quantities?

  • Are we defining any new metrics?

  • Are we using specific models to fit/explain the data?

Here you can add equations to help you with the definition of your metrics, or to explain the rationale behind your model choice and the scientific question you are interested in.

  • Results: This is the heart of your report. Here come your figures, maybe some tables, and the description of your findings. You want to answer questions such as:

  • What did we find?

  • How do we interpret these results?

  • What do they mean in the context of our problem?

DOs:

  • Make the text and figures work together to tell a coherent story.
  • Make the figures clear and informative, maximising the ratio of information to ink
  • Provide clear and informative captions for your figures, so that they can be understood even without reading the main text.
  • Annotate the figures (with arrows or text) to highlight the key findings, and to guide the reader’s attention to the most important aspects.
  • Use tables to summarize key results, but avoid overwhelming the reader with too much information.
  • Lead the reader step by step, showing how the results build on each other to support your conclusions.

DON’Ts:

  • Don’t produce many figures with the same information. Combine them together, especially if the combination allows for easier comparison.

  • Do not add figures that are not explained in the text. Every figure should be referenced and explained.

  • Do not speculate on the results. Speculative interpretation can be added in the conclusion/discussion, but the results focus on the facts.

  • Conclusions: Here you want to briefly summarise your findings and their implications. You should clearly address the scientific questions that you set out in the earlier sections (e.g. the introduction and the methodology), and explain how your results answer those questions.

In practice, in the conclusions you should more briefly recap what you wanted to tell us, confirm the main statements and findings, and then add a discussion of the limitations of your approach and possible future directions for research.

On referencing and citations

In the scientific literature, references are key as they situate the work within context, allows for comparisons with previous work, and gives credit to the original authors. In the context of a short computational reports, references can be more limited and focussed on:

  • Linking to broader introductory context.
  • Explicitly citing the data source, if it is not original data collected by you.
  • Citing the specific algorithms or models you are using, especially if they are not standard
  • Citing specific libraries or tools that you are using, especially if they are not widely known.

This means that it is definitely possible to cite numpy or pandas or seaborn, but not strictly necessary since these are widely used.

Report quality

The quality of a report is multi-faceted. When completing your report, ask yourself the following questions:

  • How accessible is my report to a reader who is not an expert in the field? You can test this by asking a friend to read your report and give you feedback on what they understood and what they found confusing.
  • Is the report well organised? If the structure is incoherent (e.g. figures are not referenced in the order they appear) it is likely that you need to rethink.
  • Is my motivation clear? Why should anyone care about this problem? Try to think of the bigger picture and the context of your work. Even if this is mostly an exercise, it uses real data and can be linked to a scientific question.
  • What are my key statements? Are they clear to identify? You could have ended up muddling the key points in a sea of details. Try to find the key points and make sure they are clearly highlighted in the text.
  • Are my statements actually supported by my figures? Figures (and tables) are the main evidence for your quantitative analysis. You should use annotations and captions to make clear that the data is coherent with your story.
  • Are my conclusions committal enough? You should be able to clearly state what your main findings are, and what they mean in the context of your problem. Avoid being too vague or speculative in your conclusions.

Style is also important. Scientific writing should focus on clarity, precision and conciseness. Some practical advice includes:

  • Use as much as possible simple and direct language: do not redefine common concepts and do not use unnecessary complex words.
  • Use first person when appropriate: this is an individual report, so you cans safely use I to refer to yourself. This can make the writing more engaging and easier to read.
  • Active vs passive voice: both are acceptable, but if you have the choice, prefer the active voice as it is more direct. For example, instead of writing “The data was analysed using Python”, you could write “I analysed the data using Python”. This makes the sentence more concise and easier to read.
  • Be precise when needed: specific concepts can be clearly conveyed using well-defined technical terms. For example if you want to distinguish between an arithmetic mean and a geometric mean, use this wording instead of a more vague “average”.

Writing a report in LaTeX

There are many tools available for writing scientific reports, but one of the most widely used is LaTeX. LaTeX is a typesetting system: it takes a plain text file with some special syntax and produces a beautifully formatted document.

It is a standard in many scientific fields, including physics, chemistry, computer science and mathematics. It is different from other extensively used tools such as Microsoft Word, which is a WYSIWYG (What You See Is What You Get) editor. In LaTeX, you write the content and the formatting is handled by the system.

The main advantages of using LaTeX for scientific reports are:

  • It produces high-quality, professional-looking documents with consistent formatting.
  • It embeds mathematical equations and symbols seamlessly, making it ideal for scientific writing.
  • It has powerful features for handling references, citations, and bibliographies.

A LaTeX editing environment can be installed on any machine. However, the University of Bristol provides you with complete access to an online LaTeX editor called Overleaf. This is a cloud-based platform that allows you to write, edit, and collaborate on LaTeX documents in real time.

You can access your account from this link: Overleaf - University of Bristol

Essential structure of a LaTeX document

It is useful to think of a LaTeX document as a script: we provide a series of instructions to teh LaTeX system. and this (through a process called compilation) produces a final human readable document (e.g. a PDF).

Similar to your Python scripts, a LaTeX document has a specific structure. The main components are:

  • Preamble: This is the section at the beginning of the document where you specify the document class, load packages, and set up any custom commands or configurations. The preamble is crucial for defining the overall structure and formatting of your document.
  • Document Body: This is the main content of your document, enclosed between \begin{document} and \end{document}. Here you write the actual text, include figures, tables, and any other content that will appear in the final document.
  • Sections and Subsections: LaTeX provides commands for structuring your document into sections, subsections, and subsubsections. This helps to organize your content and makes it easier for readers to navigate through your report.
  • Figures and Tables: You can include figures and tables in your LaTeX document using the figure and table environments. This allows you to add captions, labels, and references to your figures and tables, making them an integral part of your report.
  • Bibliography: If you are using references, this is the section where you list all the sources you cited in your document. This can be done manually or using a bibliography management tool like BibTeX.

In LaTeX, commands are typically identified by a backslash \ followed by the command name. For example, \section{Introduction} creates a new section titled “Introduction”.

Similar to a Python, script one can add comments, by prepending a line with a % symbol. This is useful for adding notes to yourself or to collaborators without affecting the final output of the document, or to temporarily disable parts of the code.

Preamble

At the top of our file, we have a few lines that specify:

  • what kind of document we are writing: this is called a document class.
  • what kind of packages we need to include in order to have all the functionalities we need (colours, figures, tables, etc.); this is very similar, in spirit, to importing libraries in Python via the import statement. Packages in LaTeX are included with a \usepackage{}

For example

\documentclass{article} % This specifies that we are writing an article. Other options include report, book, etc
\usepackage[utf8]{inputenc} % This package allows us to use UTF-8 encoding, which is standard for most documents
\usepackage{graphicx} % This package allows us to include graphics (figures)
\usepackage{amsmath} % This package provides advanced mathematical typesetting capabilities
\usepackage{hyperref} % This package allows us to create hyperlinks in our document

Document body

In the document body we have the actual content of the report. We add here our title, abstract, sections, figures, tables, etc.

The body is enclosed between \begin{document} and \end{document}. This may be thought as a single block of code (e.g. an indented block in Python) that contains all the content of our report. LaTeX extensively uses such \begin{...} ... \end{..} blocks called environments to structure the content, e.g. for figures and tables.

Sections and subsections

To construct sections, LaTeX has has a hierarchy of command:

  • \section{} for sections
  • \subsection{} for subsections
  • \subsubsection{} for subsubsections (if available in the document class)

LaTeX automatically numbers these sections and keeps track of the hierarchy, without you having to worry about it.

You can avoid numbering sections by using the * version of the command, e.g. \section*{} or with global settings taht depend on your document class.

Figures and tables

Figure and tables are specific environments in LaTeX, which means that they are enclosed between \begin{figure} ... \end{figure} and \begin{table} ... \end{table} respectively.

A figure is quite a complex environment composed of many parts:

  • an \includegraphics{} command that specifies the path to the image file you want to include in your document
  • a \caption{} command that provides a caption for the figure, which is important for explaining what the figure shows and for referencing it in the text
  • a \label{} command that assigns a unique identifier to the figure, allowing you to reference it later in the text using a \ref{} command.

For example

\begin{figure}[htbp] % This specifies that the figure should be placed here (h), at the top of the page (t), at the bottom of the page (b), or on a separate page (p)
    \centering % This centers the figure
    \includegraphics[width=0.8\textwidth]{path/to/your/figure.png} % This includes the figure and specifies its width as 80% of the text width
    \caption{This is the caption for the figure.}
    \label{fig:my_figure} % This assigns a label to the figure for referencing
\end{figure}

We can reference this figure in the main text using \ref{fig:my_figure}, which will automatically insert the correct figure number. This means, again, that we do not need to worry about the numbering of our figures, as LaTeX will handle it for us.

Tables also have a specific structure. One first constructs a \begin{table} ... \end{table} environment, similar to figures. Then, inside the table environment, we can use the tabular environment to create the actual table.

The tabular environment allows you to define the number of columns and their alignment. For example:

\begin{table}[htbp]
    \centering  
    \begin{tabular}{|c|c|c|} % This specifies a table with 3 columns, all centered, and with vertical lines between them
        \hline % This adds a horizontal line at the top of the table
        Column 1 & Column 2 & Column 3 \\ % This is the header row
        \hline % This adds a horizontal line after the header
        Data 1 & Data 2 & Data 3 \\ % This is the first data row
        Data 4 & Data 5 & Data 6 \\ % This is the second data row
        \hline % This adds a horizontal line at the bottom of the table
    \end{tabular}
    \caption{This is the caption for the table.}
    \label{tab:my_table} %this could be any string but the convention is to start with "tab:" for tables and "fig:" for figures
\end{table}

As you can see the construction of the table involves many instructions:

  • the \begin{tabular}{|c|c|c|} command specifies that we want a table with 3 columns, all centered (indicated by c), and with vertical lines between them (indicated by |). We could have different alignments (e.g. l for left-aligned, r for right-aligned) and different numbers of columns as well as different line styles (e.g. no lines, or double lines).
  • the \hline command adds a horizontal line to the table. We can use it to separate the header from the data, and to add lines at the top and bottom of the table.
  • the & symbol is used to separate columns within a row, and the \\ symbol is used to indicate the end of a row.
Placement of floats

Figures and tables are so-called floats in LaTeX. This behaviour can be quite surprising (and often annoying) when encountering LaTeX for the first time.

In practice, LaTeX will try to optimise the placement of figures and tables, and it may not always place them exactly where you put the code for them in the document. This “optimum” is very often not what we want and it actuyally can depend on how much text precedes or follows the figure in your source LaTeX file (the pure text code).

LaTeX can take some hints from you for the placement, in the form of the optional argument in \begin{figure}[htbp] and \begin{table}[htbp]. The letters in the square brackets indicate your preferences for where the figure or table should be placed:

  • h (here): Place the float at the position in the text where the code is written.
  • t (top): Place the float at the top of a page.
  • b (bottom): Place the float at the bottom of a page.
  • p (page): Place the float on a separate page dedicated to floats.

For a report, modelled on the appearence of scientific papers, it is best to prefer figures that are placed either at the top or at the bottom of the page, as this is the most common style in scientific writing. This means that you should use [tb] as your placement specifier for figures and tables.

References and citations

In this report, you will not perform a literature review. You may still have a few references as indicated above. There are two main strategies to include references in a LaTeX document:

  • Manual referencing: You can manually add references in a bibliography section at the end of your document. This involves creating a list of references and citing them in the text using \cite{} commands. This may be largely sufficient for our short report but requires care in typing the correct bibliographic information.

  • Automatic referencing with BibTeX: The true advantage of using LaTeX for references is that it can use a database of references (stored in a sepearate .bib file) to create a reference section according to the cited material using an utomatic tool called BibTeX which is fully (and automatically integrated in Overleaf). This is flexible and much less error prone. We will focus on this second method.

BibTeX files

A BibTeX file is a separate plain text file that you will also find in you Project template. It has a .bib extension and it contains a list of references in a specific format. Each reference is defined by an entry that starts with an @ symbol followed by the type of reference (e.g. @article, @book, etc.) and a unique identifier for that reference (an alphanumeric string). These entries are very similar to a Python dictionary, with key-value pairs that provide the bibliographic information for each reference (e.g. author, title, year, etc.).

For example, a BibTeX entry for a journal article might look like this:

@article{metropolis1953,
    author = {Metropolis, Nicholas and Rosenbluth, Arianna W. and Rosenbluth, Marshall N. and Teller, Augusta H. and Teller, Edward},
    title = {Equation of State Calculations by Fast Computing Machines},
    journal = {The Journal of Chemical Physics},
    volume = {21},
    number = {6},
    pages = {1087-1092},
    year = {1953},
    month = {06},
    issn = {0021-9606},
    doi = {10.1063/1.1699114},
    url = {https://doi.org/10.1063/1.1699114},
}

As you can see, the individual entry is very rich. The metropolis1953 string is the cite key, the unique identifier that we can use to refer to the refernce throughouts our document using the command \cite{metropolis1953}. There follows a number of fields envoding a lot of information, including in mnay cases urls.

This is useful, as it can make a refernece section interactive with hyperlinks (by the combined addition of the \usepackage{hyperref} in the preamble).

Other kinds of items include:

Book:

@book{Womersley2022,
  author = {Womersley, Jane},
  title = {Fundamentals of Data Analysis for Environmental Science},
  publisher = {Oxford University Press},
  year = {2022},
  edition = {2nd}
}

Website/Online Documentation:

@misc{PandasDevelopmentTeam2024,
  author = {{The Pandas Development Team}},
  title = {Pandas: Python Data Analysis Library},
  year = {2024},
  url = {https://pandas.pydata.org/},
  note = {Accessed: March 12, 2026}
}

Dataset:

@dataset{Kaggle2024,
  author = {{Kaggle}},
  title = {Titanic: Machine Learning from Disaster},
  year = {2024},
  url = {https://www.kaggle.com/c/titanic},
  note = {Dataset retrieved from Kaggle}
}

Software

@software{reback2020pandas,
    author       = {The pandas development team},
    title        = {pandas-dev/pandas: Pandas},
    month        = feb,
    year         = 2020,
    publisher    = {Zenodo},
    version      = {latest},
    doi          = {10.5281/zenodo.3509134},
    url          = {https://doi.org/10.5281/zenodo.3509134}
}

To use the BibTeX file in your LaTeX document, you need to include the following commands in the body of your document at the end, where you want the bibliography to appear:

\bibliographystyle{plain} % This specifies the bibliography style (e.g. plain)
\bibliography{references} % This specifies the name of your .bib file (without the .bib extension)

You can choose different bibliography styles. The recommended styles for scientific reports are

  • plain: This style sorts the bibliography entries alphabetically by author and formats them in a simple, straightforward manner.
  • unsrt: This style is similar to plain, but it does not sort the bibliography entries. Instead, it lists them in the order they are cited in the document.
  • abbrv: This style is similar to plain, but it uses abbreviated first names and journal names to save space.
  • whhen using the revtex4-2 document class (as in your report) we advise you to use the apsrev4-2 bibliography style.