Feature #910

Implement automatic check of python examples from users examples directory

Added by pospelov over 5 years ago. Updated over 5 years ago.

Status:ArchivedStart date:02 Dec 2014
Priority:NormalDue date:
Assignee:pospelov% Done:

0%

Category:-
Target version:Sprint 25

Description

It has to walk through all examples contained in python/simulation directory to automatically produce *.png images.

The script will serve to two purposes.

1. During the release we can run the script to make sure that examples are not broken.

2. The *.png images produced by the script we can use to upload on our web site to reduce the amount of manual work.

In principle, we can even ask the script to compare produced images with whose stored on website. And in the case of difference, the script will notify us that the examples section of the website needs to be updated.

History

#1 Updated by pospelov over 5 years ago

  • Description updated (diff)
  • Status changed from New to Sprint
  • Assignee set to pospelov
  • Target version set to Sprint 25

#2 Updated by pospelov over 5 years ago

  • Status changed from Sprint to Resolved

New script is available to validate user examples.

Usage:

cd <BornAgain-source>/dev-tools/check-examples
python check_examples.py <BornAgain-source>/Examples/python/simulation

The script will create a temp directory in current working directory and generates png images for every example.
At the end it will print following table:

--------------------------------------------------------------------------------
Python examples summary
Directory: /home/pospelov/development/BornAgain/source/Examples/python/simulation/
--------------------------------------------------------------------------------
ex01_BasicParticles/AllFormFactorsAvailable.py                    EMPTY?               
ex01_BasicParticles/CylindersAndPrisms.py                         OK                   
ex01_BasicParticles/CylindersInBA.py                              OK         [website differs]
ex01_BasicParticles/CylindersInDWBA.py                            OK         [website OK]
ex01_BasicParticles/CylindersWithSizeDistribution.py              FAILED               
ex01_BasicParticles/RotatedPyramids.py                            OK                   
ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py    FAILED               
ex02_LayeredStructures/BuriedParticles.py                         OK                   
ex02_LayeredStructures/CorrelatedRoughness.py                     OK                   
ex03_InterferenceFunctions/ApproximationDA.py                     EMPTY?               
ex03_InterferenceFunctions/ApproximationLMA.py                    EMPTY?               
ex03_InterferenceFunctions/ApproximationSCCA.py                   EMPTY?               
ex03_InterferenceFunctions/CosineRipple.py                        OK         [website OK]
ex03_InterferenceFunctions/Interference1DLattice.py               OK                   
ex03_InterferenceFunctions/Interference2DLattice1.py              OK                   
ex03_InterferenceFunctions/Interference2DLattice2.py              OK                   
ex03_InterferenceFunctions/Interference2DLattice3.py              OK                   
ex03_InterferenceFunctions/Interference2DLattice4.py              FAILED               
ex03_InterferenceFunctions/InterferenceParaCrystal1D.py           OK                   
ex03_InterferenceFunctions/InterferenceParaCrystal2D.py           OK                   
ex03_InterferenceFunctions/SpheresAtHexLattice.py                 OK                   
ex03_InterferenceFunctions/TriangularRipple.py                    OK                   
ex04_ComplexShapes/CoreShellNanoparticles.py                      OK                   
ex04_ComplexShapes/CustomFormFactor.py                            OK                   
ex04_ComplexShapes/HexagonalLatticeWithBasis.py                   OK                   
ex04_ComplexShapes/LargeParticlesFormFactor.py                    EMPTY?               
ex04_ComplexShapes/MesoCrystal.py                                 EMPTY?               
ex05_BeamAndDetector/BeamDivergence.py                            OK                   
ex05_BeamAndDetector/DetectorResolutionFunction.py                OK                   
ex05_BeamAndDetector/OffSpecularSimulation.py                     OK      

The line

ex01_BasicParticles/CylindersInDWBA.py                            OK         [website OK]

means that example CylindersInDWBA.py has generated png image successfully and that the script on website coincide with the script from Examples.

If status of website is indicated as "website differs", than we have to manually update corresponding website example (file with script, png image, code snippet).

#3 Updated by herck over 5 years ago

  • Status changed from Resolved to Archived

Also available in: Atom PDF