Skip to content

Commit

Permalink
Adding gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise committed Mar 1, 2024
1 parent c4e4c80 commit f8d960a
Show file tree
Hide file tree
Showing 16 changed files with 252 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/gallery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
How to add new images to the slideshow
======================================

1. Copy the images you wish to add to the gallery to this folder. The images
must be in `.png` format.
2. Run the `make_gallery.sh` script. This will append the new image data to
`gallery.rst`. Alternatively, edit `gallery.rst` yourself if you don't want
the new picture to be at the end of the slideshow.
3. Edit the alt text for the new images you have added in `gallery.rst`; these
will be at the bottom of the file. Otherwise they will be captioned with
Lorem Ipsum.
4. Run the `make_html_entry.sh` script. This will rebuild the html part of the
gallery automatically.
5. Commit the `.png` file and the the modified `gallery.rst` and
`slideshow.html` files.
Binary file added docs/gallery/atr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gallery/bsm_work.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gallery/fludag_ni_proton_mag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gallery/fng_neutron_tetmesh_mcnp5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gallery/fng_sdr_fluka.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions docs/gallery/gallery.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Gallery of projects that use DAGMC
==================================

.. image:: hab1.png
:alt: NASA habitat module irradiated by 1 GeV protons, FluDAG

----

.. image:: pppl_fnsf.png
:alt: PPPL Fusion Nuclear Science Facility (FNSF)

.. image:: atr.png
:alt: Advanced Test Reactor (ATR) cross section

.. image:: sns_proton.png
:alt: Proton flux in Spallation Neutron Source (SNS), DAG-MCNP6

.. image:: bsm_work.png
:scale: 45
:alt: Fusion system blanket shield module, DAG-MCNP5

.. image:: fng_sdr_fluka.png
:alt: Frascati Neutron Generator (FNG) SDR geometry, FluDAG

.. image:: fludag_ni_proton_mag.png
:alt: Protons being deflected by magnetic field, interacting on nickel block, FluDAG

.. image:: hab_module_proton_daggeant4.png
:alt: Proton irradiation of NASA habitat module, DagGeant4

.. image:: iter_elm_coils_heating.png
:alt: Nuclear heating behind the ITER blanket modules including the presence of ELM coils, DAG-MCNP5

.. image:: pppl_fnsf_tritium.png
:alt: Tritium reaction rate in PPPL ST-FSNF, DAG-MCNP5

.. image:: fng_neutron_tetmesh_mcnp5.png
:alt: Neutron flux in FNG SDR geometry, DAG-MCNP5
Binary file added docs/gallery/hab1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gallery/hab_module_proton_daggeant4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions docs/gallery/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Gallery
=======

Below is an array of analysis results produced using DAGMC.

----

.. figure:: hab1.png
:align: center

NASA habitat module irradiated by 1 GeV protons, FluDAG

----

.. figure:: pppl_fnsf.png
:align: center

PPPL Fusion Nuclear Science Facility (FNSF)

----

.. figure:: atr.png
:align: center

Advanced Test Reactor (ATR) cross section

----

.. figure:: sns_proton.png
:align: center

Proton flux in Spallation Neutron Source (SNS), DAG-MCNP6

----

.. figure:: bsm_work.png
:align: center
:scale: 45

Fusion system blanket shield module, DAG-MCNP5

----

.. figure:: fng_sdr_fluka.png
:align: center

Frascati Neutron Generator (FNG) SDR geometry, FluDAG

----

.. figure:: fludag_ni_proton_mag.png
:align: center

Protons being deflected by magnetic field, interacting on nickel block, FluDAG

----

.. figure:: hab_module_proton_daggeant4.png
:align: center

Proton irradiation of NASA habitat module, DagGeant4

----

.. figure:: iter_elm_coils_heating.png
:align: center

Nuclear heating behind the ITER blanket modules including the presence of ELM coils, DAG-MCNP5

----

.. figure:: pppl_fnsf_tritium.png
:align: center

Tritium reaction rate in PPPL ST-FSNF, DAG-MCNP5

----

.. figure:: fng_neutron_tetmesh_mcnp5.png
:align: center

Neutron flux in FNG SDR geometry, DAG-MCNP5
Binary file added docs/gallery/iter_elm_coils_heating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions docs/gallery/make_gallery.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# scans the current directory and for each new file not already existing in the
# gallery.rst file, creates a new entry, the person adding the file will however
# need to add descriptive text

file=gallery.rst

# function to write a gallery entry
function gallery_entry()
{
echo "" >> $2
echo ".. image::" $1 >> $2
echo " :alt: Dummy Text Lorem Ipsum" >> $2
}

# for each png file
for i in *.png ; do
if ! grep -q $i gallery.rst ; then
gallery_entry $i $file
fi
done
95 changes: 95 additions & 0 deletions docs/gallery/make_html_entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/bin/bash

# on the basis of the entries in gallery.rst file
# produce the html snippet that allows to make the
# gallery on the front page

# this function writes the html entry for a given image, as determined
# from the gallery.rst entry
function html_slide_entry()
{
slide_number="$1"
number_of_slides="$2"
imagename="$3"
alttext="$4"
output_html="$5"

echo ' <div class="mySlides fade">' >> $5
echo ' <div class="numbertext">'$1' / '$2'</div>' >> $5
echo ' <img src="_images/'$3'" style="width:100%">' >> $5
echo ' <div class="text">'$4'</div>' >> $5
echo ' </div>' >> $5
echo '' >> $5
}

# writes the forward and backward buttons
function html_write_buttons
{
outfile=$1
echo ' <a class="prev" onclick="plusSlides(-1)">&#10094;</a>' >> $outfile
echo ' <a class="next" onclick="plusSlides(1)">&#10095;</a>' >> $outfile
}

# writes the dots for the images
function html_write_dots
{
dot_type="$1"
num_dots="$2"
outfile="$3"
echo '<div style="text-align:center">' >> $outfile
for (( i = 1 ; i <= $num_dots ; i++ )) ; do
echo ' <span class="'$dot_type'" onclick="currentSlide('$i')"></span>' >> $outfile
done
echo '</div>' >> $outfile
echo '' >> $outfile
}


# this is the input rst file which determines, what the html will show
gallery_file="gallery.rst"

# the file we are writing out to
out_file="test.html"

# determine the number of images
num_images=`grep -c ' image::' $gallery_file`

# write the start of the html section
echo '<!-- SLIDESHOW CONTENT -->' > $out_file
echo '<!-- START OF SCRIPTED CONTENT -->' >> $out_file
echo '<br>' >> $out_file
echo '<div class="slideshow-container">' >> $out_file

# loop over the number of slides
for (( i = 1 ; i <= $num_images ; i++ )) ; do
alttext=`grep ":alt:" $gallery_file | sed -n "$i"p | cut -d ' ' -f6-`
img_file=`grep "image::" $gallery_file | sed -n "$i"p | awk '{print $3}'`
echo $alttext $img_file
html_slide_entry $i $num_images $img_file "$alttext" $out_file
done

# write the buttons
html_write_buttons $out_file

echo '</div>' >> $out_file
echo '<br>' >> $out_file

# write the dots
html_write_dots "dot" $num_images $out_file

echo '<!-- END OF SCRIPTED CONTENT -->' >> $out_file

# now we insert the autogen content into the slideshow file
# determine the line on which we insert the auto get content
breakline=`grep -n "<\!-- WE WILL INSERT AUTO GEN CONENT HERE -->" ../slideshow_empty.html | sed -e s'/:/ /'g | awk '{print $1}'`
breaklineplus1=$(($breakline+1))
filelength=`wc -l ../slideshow_empty.html | awk '{print $1}'`

# first print out the file upto the break point
sed -n 1,"$breakline"p ../slideshow_empty.html > ../slideshow.html
# dump the contents of the autogen file into the slideshow
cat $out_file >> ../slideshow.html
# now print out the rest of the slideshow
sed -n "$breaklineplus1","$filelength"p ../slideshow_empty.html >> ../slideshow.html

# all done :)
Binary file added docs/gallery/pppl_fnsf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gallery/pppl_fnsf_tritium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/gallery/sns_proton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f8d960a

Please sign in to comment.