Prerequisites: 
Python 3.6.8 and MATLAB R2018b (9.5.0.944444) 64-bit (glnxa64) August 28, 2018
Python 3 packages: matplotlib=3.0.3, numpy=1.16.4, scipy=1.1.0, Pillow=5.4.1

--------------------------------------------------------------------------------
Figures

Figures 2 (abridged) and 15 (full) are generated by plot_best_p_approx_var_with_dnn.py
command:python plot_best_p_approx_var_with_dnn.py

Figure 9 images can be viewed by running view_image.py or view_image.m 
Methods to view the images using either MATLAB or python.
Generated perturbed images (in txt format) can also be viewed by using the same scripts.
    There is only one argument:
    - path to the photo "x"

    sample command:

    python view_image.py -x ../data/1_center_images/panda.txt
    view_image('../data/panda.txt')

Figure 3 is generated by generate_perturbed_photo.py or generate_perturbed_photo.m
Methods to generate perturbed images using either MATLAB or python.
   There are four arguments:
   - path to the original natural photo "x0"
   - path to perturbation direction "v" 
   - perturbation scale "a"
   - path to output file to save the perturbed image
   sample command:
   
   python generate_perturbed_photo.py -x ../data/1_center_images/panda.txt -v ../data/2_rays/panda_M_RGB_Box.txt -a 128 -o panda_perturbed.txt
   
   generate_perturbed_photo('../data/panda.txt', '../data/panda_M_RGB_Box.txt', 128, 'panda_perturbed.txt')

Figure 5 is generated by boxplot_a_with_GiveUp_counts.py
command: python boxplot_a_with_GiveUp_counts.py

Figures 6, 8 and 11 (in appendix) for pixel p-norms are generated by boxplot_pixel_norms.py
command: python boxplot_pixel_norms.py

Figure 7(left, 1-SSIM) and Figure 13 (in appendix) are generated by boxplot_ssim.py
command: python boxplot_ssim.py

Figure 7(center, DNN) and Figure 14 (in appendix) are generated by boxplot_dnn_representation_norms.py
command: python boxplot_dnn_representation_norms.py

Figure 7(right, EMD) and Figure 12 (in appendix) are generated by boxplot_emd.py
command: python boxplot_emd.py

--------------------------------------------------------------------------------
Hypothesis Tests

Hypothesis Test k is performed by hypothesis_test_k.py, for k=1...9
command: python hypothesis_test_k.py

