Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions experiments/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env python
#
# coding: utf-8
#
# SConstruct (Madagascar Script)
#
# Purpose: Tracked build of the experiments in this directory and
# automatic report.
#
# Site: https://dirack.github.io
#
# Version 1.0
#
# Programer: Rodolfo A C Neves (Dirack) 10/09/2020
#
# Email: [email protected]
#
# License: GPL-3.0 <https://www.gnu.org/licenses/gpl-3.0.txt>.

from rsf.tex import *
from rsf.proj import Flow
import os
import logging
import tempfile

env = Environment(ENV=os.environ)
env.AlwaysBuild('paper.tex')

logfile = tempfile.mkstemp(suffix='.log')[1]

logging.basicConfig(filename=logfile,level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s')

logging.info('PSTA ***[Experiment Started]***')

#experiments = ['fullInterpolationAndStack',
# 'fullInterpolationAndStackCDS',
experiments = [ 'multiLayerModel/cds',
'multiLayerModel/cre']
sconscripts = filter(os.path.isfile,map(lambda e: str(e)+'/SConstruct',experiments))

logging.debug('experiments = %s' % experiments)
logging.debug('sconscripts = %s' % sconscripts)

succed=0
fail=0
total=len(experiments)

for i in sconscripts:
try:
SConscript(i,exports='env')
logging.info("Experiment %s Succed!",i)
succed = succed + 1
except:
logging.error("PERR Experiment %s Failed!",i)
fail = fail + 1
currentExperimentDir = os.path.dirname(i)
logging.warning(
'''Experiment Failed - Show files list\n\t Files=> %s
''', str(os.listdir(currentExperimentDir)))

if os.path.isdir(currentExperimentDir+'/'+'Fig'):
logging.warning(
'''Experiment Failed - Show Fig list\n\t Fig=> %s
''', str(os.listdir(currentExperimentDir+'/'+'Fig')))

# Try to run a BUGSCRIPT (This is a SConscript with another name
# to allow the experiment to do a set of commands if the build fails)
if os.path.isfile(currentExperimentDir+'/BUGSCRIPT'):
try:
SConscript(currentExperimentDir+'/BUGSCRIPT')
except:
logging.warning("BUGSCRIPT failed!")

logging.info('PEND Total of '+str(fail+succed)+'/'+str(total)+' experiments executed, '+str(fail)+' failed and '+str(succed)+' succed')

logging.disable(logging.CRITICAL)
Flow('paper.tex',None,
'''
./log2tex %s
''' %(logfile))

End(options='reproduce',
include=r'''
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage{listings}
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\setlength{\parindent}{1.3cm}
\usepackage{color}
\definecolor{mygray}{rgb}{0.8,0.8,0.8}
\lstset{backgroundcolor=\color{mygray},breaklines=true}
''')
56 changes: 20 additions & 36 deletions experiments/fullInterpolationAndStack/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#
# SConstruct (Madagascar Script)
#
# Purpose: Build the interpolation process twice to improve CMP sampling
# and CRE stacking results.
# Purpose: Common Reflection Element (CRE) stack applied to a seismic data cube
# from Kirchhoff modeling of a gaussian reflector in a linear velocity model.
#
# Site: http://www.dirackslounge.online
# Site: https://dirack.github.io
#
# Version 1.0
# Version 2.0
#
# Programer: Rodolfo A. C. Neves (Dirack) 04/03/2020
#
Expand All @@ -19,45 +19,23 @@
# Madagascar package
from rsf.proj import *

# CRE recipe
from creStack import kirchoffModeling as kimod
from creStack import pefInterpolation as pefin

# Import glob python library
import glob

# Generate Gaussian reflector model and data cube
kimod()

# PEF interpolation of the data cube
pefin('dataCube',
'interpolatedDataCube',
nm=401,
dm=0.025,
nt=1001,
dt=0.004,
nhi=161)

# Do the PEF interpolation one more time
# to increase the CMP sampling
pefin('interpolatedDataCube',
'interpolatedDataCube2',
nm=802,
dm=0.0125,
nt=1001,
dt=0.004,
nhi=161)

# CRE stacking
# It uses Very Fast Simulated Aneeling and non hyperbolic CRS
# to get zero offset CRS parameters (RN, RNIP and BETA) from data cube
v0 = 1.5
ot0 = 1.0
dt0 = 0.004
nt0 = 500
nt0 = 500
om0 = 3
dm0 = 0.5
nm0 = 9
inputDir = '../modelingAndPEFInterpolation/gaussianModel/'
dataCube = inputDir+'dataCube.rsf'
interpolatedDataCube = inputDir+'interpolatedDataCube2.rsf'
files = []

for i in range(nm0):

Expand All @@ -82,22 +60,22 @@ for i in range(nm0):
creGatherPlot = 'crePlot-m0-%g-t0-%g' % (i,j)

# Very Fast Simulated Aneelling Global Optimization (VFSA)
Flow(crsParameters,'dataCube',
Flow(crsParameters,dataCube,
'''
vfsacrsnh m0=%g v0=%g t0=%g verb=y repeat=3
''' % (m0,v0,t0))

# Calculate CRE trajectory
Flow(creMhCoordinates,['interpolatedDataCube2',crsParameters],
Flow(creMhCoordinates,[interpolatedDataCube,crsParameters],
'''
cretrajec verb=y m0=%g param=${SOURCES[1]} |
put unit1="Offset" label1="Km"
''' % (m0))

#Get CRE Gather from interpolated Data Cube
Flow([creGather,creMcoordinate],['interpolatedDataCube2',creMhCoordinates],
Flow([creGather,creMcoordinate],[interpolatedDataCube,creMhCoordinates],
'''
getcregather verb=y cremh=${SOURCES[1]} m=${TARGETS[1]} |
getcregather verb=y cremh=${SOURCES[1]} m=${TARGETS[1]} aperture=20 |
put label1="Time" unit1="s" label2="Offset" unit2="km"
''')

Expand Down Expand Up @@ -155,9 +133,15 @@ for i in range(nm0):
put label1=t0 unit1=s label2=m0 unit2=Km --out=stdout
''')

files.append(creStackedTrace)

# Stacked section depends of the last CRE stacked trace
Depends('stackedSection.rsf',[dataCube,
'creStackedTrace-m0-'+str(nm0-1)+'.rsf',
'creGatherTrace-m0-'+str(nm0-1)+'.rsf'])

# Build the cre stacked section
# throughout cre stacked traces sorting
files = glob.glob('creStackedTrace-*.rsf')
length = len(files)

sortedFiles = []
Expand Down
165 changes: 0 additions & 165 deletions experiments/fullInterpolationAndStack/creStack.py

This file was deleted.

Loading