Skip to content

Conversation

@Dirack
Copy link
Owner

@Dirack Dirack commented Sep 20, 2020

📤 Pull Request

Description

  • Establish explicit dependencies in experiments SConstructs to avoid errors during the building with multiple threads.

  • Test the building using Python unittest module in the files 'test_modelBuild.py' (modeling and PEF interpolation test) and 'test_experiments.py' (experiments test).

  • Use 'AddPostAction' SCons method and 'clean.sh' script to clean the temporary files after the building.

  • Update the directory tree to separate modeling and PEF interpolation step of CRE stacking

Resolve #44 and #45

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Add images bellow and additional context if needed

  • Current directories tree:
.
├── diagrams
├── experiments
│   ├── fullInterpolationAndStack
│   ├── fullInterpolationAndStackCDS
│   ├── modelingAndPEFInterpolation
│   │   ├── gaussianModel
│   │   └── multiLayerModel
│   └── multiLayerModel
│       ├── cds
│       └── cre
├── images
└── TDD

12 directories
  • Inside the experiments folder are the tests 'test_experiments.py' and 'test_modelBuild.py':
.
├── fullInterpolationAndStack
│   ├── kimodel.pyc
│   └── SConstruct
├── fullInterpolationAndStackCDS
│   └── SConstruct
├── modelingAndPEFInterpolation
│   ├── gaussianModel
│   │   ├── clean.sh
│   │   ├── kimodel.py
│   │   └── SConstruct
│   ├── multiLayerModel
│   │   ├── clean.sh
│   │   ├── kimodel.py
│   │   └── SConstruct
│   └── test_modelBuild.py
├── multiLayerModel
│   ├── cds
│   │   └── SConstruct
│   └── cre
│       └── SConstruct
├── README.md
├── SConstruct
└── test_experiments.py

8 directories, 15 files
  • Run the tests with the command:
~$ python -m unittest test_modelBuild

And:

~$ python -m unittest test_experiments

Use Depends scons method to explicit declare dependencies to scons
Changes pefInterpolation function calling from fullInterpolationAndStack
experiments.

The pefInterpolation.py recipe is now part of official Madagascar
package. Because of that, SConstruct can call it from local Madagascar
installation.
Error report function was deleted from official repository
because it makes building and error report slow. Use python
logging functions to report errors in SCons
The building of the experiment is splitted in several SConscripts.
Concatenate all the building steps in one SConstruct. And use the
Madagascar recipes 'kimodel.py' and 'pefInterpolation.py'.

Those recipes are available in the official Madagascar package
repository on github. Because of that they can be called from
SConstruct.
Because those recipes are available in Madagascar package
it is no longer require to store a copy of then in this repository
Define explicit dependencies to the experiments in multiLayerModel
with Depend method in scons to avoid errors in parallel building,
Resolve #44
The atexit will launch the after_build function that calls os.system
commands to remove rsf temporary files. And establish the datacube and
multiLayerDataCube as a stacked section dependency
Do a simple test of the experiments and SConstruct building for a
couple of (m0,t0) pairs
As referenced in bug report #49, aperture parameter should be the
same for the programs sfcrestack and sfgetcregather to avoid building
errors in the stacking. Aperture parameter is the number of offsets
to consider in the cre trajectory for sfgetcregather and the number
of offsets to stack in sfcrectack.

This parameter was introduced in sfgetcregather program to correct
bug #38
The stacked section depends of the creGatherTraces and creStackedTraces too.
So, Establish both as stacked section dependencies
To avoid multiple buildings of modeling and PEF interpolation steps
separate the modeling and interpolation in another directory
The variable 'file' was loaded before cre stacking loop. It used glob
method to receive the stacked traces list available in the directory
to sort and build the stacked section.

The problem is if the variable is loaded before the loop, glob won't
find any stacked traces, because they are not build already! So, in order
to explicit tell scons to load 'files' variable after the loop, put the
variable as an empty list and load the values during the for loop with
append method
To avoid problems and mixed outputs separate the models in two folders
This SConstruct tracks the experiments execution and does an automatic
report of then in latex. This is a simple test of the experiments with
a few common offset gathers interpolated and a few cre stacked traces
to build the stacked section
Use script 'clean.sh' to delete temporary files. The function
AddPostAction will assure that clean.sh will be called after the
'interpolatedDataCube2.rsf' building
The 'test_modelBuild.py' file tun the unit tests of the modeling
and PEF interpolation steps that will produce the input to the CRE
stacking step.

Run this test with:
~$ python -m unittest test_modelBuild
Tests of the experiments. Run with:

~$ python -m unittest test_experiments
@Dirack Dirack added the enhancement New feature or request label Sep 20, 2020
@Dirack Dirack added this to the v2.0 milestone Sep 20, 2020
@Dirack Dirack self-assigned this Sep 20, 2020
@Dirack Dirack marked this pull request as ready for review September 20, 2020 14:02
@Dirack Dirack merged commit 35aa3c9 into develop/2.0 Sep 20, 2020
@Dirack Dirack deleted the feature/issue/44 branch September 20, 2020 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA] Add pef interpolation example to Madagascar package recipes [FEA] Use SCons explicity dependency to avoid building errors

2 participants