Merge pull request #80 from yunjunz/stripmapStack_unwrap
stripmapStack/unwrap: uncomment corrLooks for snaphuLT1AB
commit
4685bed292
|
@ -197,6 +197,8 @@ class config(object):
|
||||||
self.f.write('nomcf : ' + self.noMCF + '\n')
|
self.f.write('nomcf : ' + self.noMCF + '\n')
|
||||||
self.f.write('master : ' + self.master + '\n')
|
self.f.write('master : ' + self.master + '\n')
|
||||||
self.f.write('defomax : ' + self.defoMax + '\n')
|
self.f.write('defomax : ' + self.defoMax + '\n')
|
||||||
|
self.f.write('alks : ' + self.alks + '\n')
|
||||||
|
self.f.write('rlks : ' + self.rlks + '\n')
|
||||||
self.f.write('method : ' + self.unwMethod + '\n')
|
self.f.write('method : ' + self.unwMethod + '\n')
|
||||||
self.f.write('##########################'+'\n')
|
self.f.write('##########################'+'\n')
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,19 @@ def extractInfoFromPickle(pckfile, inps):
|
||||||
data['earthRadius'] = elp.local_radius_of_curvature(llh.lat, hdg)
|
data['earthRadius'] = elp.local_radius_of_curvature(llh.lat, hdg)
|
||||||
|
|
||||||
#azspacing = burst.azimuthTimeInterval * sv.getScalarVelocity()
|
#azspacing = burst.azimuthTimeInterval * sv.getScalarVelocity()
|
||||||
azres = 20.0
|
#azres = 20.0
|
||||||
|
azspacing = sv.getScalarVelocity() / burst.PRF
|
||||||
|
azres = burst.platform.antennaLength / 2.0
|
||||||
|
azfact = azres / azspacing
|
||||||
|
|
||||||
|
burst.getInstrument()
|
||||||
|
rgBandwidth = burst.instrument.pulseLength * burst.instrument.chirpSlope
|
||||||
|
rgres = abs(SPEED_OF_LIGHT / (2.0 * rgBandwidth))
|
||||||
|
rgspacing = burst.instrument.rangePixelSize
|
||||||
|
rgfact = rgres / rgspacing
|
||||||
|
|
||||||
#data['corrlooks'] = inps.rglooks * inps.azlooks * azspacing / azres
|
#data['corrlooks'] = inps.rglooks * inps.azlooks * azspacing / azres
|
||||||
|
data['corrlooks'] = inps.rglooks * inps.azlooks / (azfact * rgfact)
|
||||||
data['rglooks'] = inps.rglooks
|
data['rglooks'] = inps.rglooks
|
||||||
data['azlooks'] = inps.azlooks
|
data['azlooks'] = inps.azlooks
|
||||||
|
|
||||||
|
@ -149,7 +159,7 @@ def runUnwrap(infile, outfile, corfile, config, costMode = None,initMethod = Non
|
||||||
altitude = config['altitude']
|
altitude = config['altitude']
|
||||||
rangeLooks = config['rglooks']
|
rangeLooks = config['rglooks']
|
||||||
azimuthLooks = config['azlooks']
|
azimuthLooks = config['azlooks']
|
||||||
#corrLooks = config['corrlooks']
|
corrLooks = config['corrlooks']
|
||||||
maxComponents = 20
|
maxComponents = 20
|
||||||
|
|
||||||
snp = Snaphu()
|
snp = Snaphu()
|
||||||
|
@ -163,7 +173,7 @@ def runUnwrap(infile, outfile, corfile, config, costMode = None,initMethod = Non
|
||||||
snp.setAltitude(altitude)
|
snp.setAltitude(altitude)
|
||||||
snp.setCorrfile(corfile)
|
snp.setCorrfile(corfile)
|
||||||
snp.setInitMethod(initMethod)
|
snp.setInitMethod(initMethod)
|
||||||
# snp.setCorrLooks(corrLooks)
|
snp.setCorrLooks(corrLooks)
|
||||||
snp.setMaxComponents(maxComponents)
|
snp.setMaxComponents(maxComponents)
|
||||||
snp.setDefoMaxCycles(defomax)
|
snp.setDefoMaxCycles(defomax)
|
||||||
snp.setRangeLooks(rangeLooks)
|
snp.setRangeLooks(rangeLooks)
|
||||||
|
@ -248,33 +258,34 @@ def runUnwrapIcu(infile, outfile):
|
||||||
unwImage.finalizeImage()
|
unwImage.finalizeImage()
|
||||||
unwImage.renderHdr()
|
unwImage.renderHdr()
|
||||||
|
|
||||||
def runUnwrap2Stage(unwrappedIntFilename,connectedComponentsFilename,unwrapped2StageFilename, unwrapper_2stage_name=None, solver_2stage=None):
|
def runUnwrap2Stage(unwrappedIntFilename,connectedComponentsFilename,unwrapped2StageFilename,
|
||||||
|
unwrapper_2stage_name=None, solver_2stage=None):
|
||||||
|
|
||||||
if unwrapper_2stage_name is None:
|
if unwrapper_2stage_name is None:
|
||||||
unwrapper_2stage_name = 'REDARC0'
|
unwrapper_2stage_name = 'REDARC0'
|
||||||
|
|
||||||
if solver_2stage is None:
|
if solver_2stage is None:
|
||||||
# If unwrapper_2state_name is MCF then solver is ignored
|
# If unwrapper_2state_name is MCF then solver is ignored
|
||||||
# and relaxIV MCF solver is used by default
|
# and relaxIV MCF solver is used by default
|
||||||
solver_2stage = 'pulp'
|
solver_2stage = 'pulp'
|
||||||
|
|
||||||
print('Unwrap 2 Stage Settings:')
|
print('Unwrap 2 Stage Settings:')
|
||||||
print('Name: %s'%unwrapper_2stage_name)
|
print('Name: %s'%unwrapper_2stage_name)
|
||||||
print('Solver: %s'%solver_2stage)
|
print('Solver: %s'%solver_2stage)
|
||||||
|
|
||||||
inpFile = unwrappedIntFilename
|
inpFile = unwrappedIntFilename
|
||||||
ccFile = connectedComponentsFilename
|
ccFile = connectedComponentsFilename
|
||||||
outFile = unwrapped2StageFilename
|
outFile = unwrapped2StageFilename
|
||||||
|
|
||||||
# Hand over to 2Stage unwrap
|
# Hand over to 2Stage unwrap
|
||||||
unw = UnwrapComponents()
|
unw = UnwrapComponents()
|
||||||
unw.setInpFile(inpFile)
|
unw.setInpFile(inpFile)
|
||||||
unw.setConnCompFile(ccFile)
|
unw.setConnCompFile(ccFile)
|
||||||
unw.setOutFile(outFile)
|
unw.setOutFile(outFile)
|
||||||
unw.setSolver(solver_2stage)
|
unw.setSolver(solver_2stage)
|
||||||
unw.setRedArcs(unwrapper_2stage_name)
|
unw.setRedArcs(unwrapper_2stage_name)
|
||||||
unw.unwrapComponents()
|
unw.unwrapComponents()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def main(iargs=None):
|
def main(iargs=None):
|
||||||
|
@ -293,24 +304,26 @@ def main(iargs=None):
|
||||||
|
|
||||||
if inps.method != 'icu':
|
if inps.method != 'icu':
|
||||||
|
|
||||||
masterShelveDir = os.path.join(interferogramDir , 'masterShelve')
|
masterShelveDir = os.path.join(interferogramDir , 'masterShelve')
|
||||||
if not os.path.exists(masterShelveDir):
|
if not os.path.exists(masterShelveDir):
|
||||||
os.makedirs(masterShelveDir)
|
os.makedirs(masterShelveDir)
|
||||||
|
|
||||||
|
inps.master = os.path.dirname(inps.master)
|
||||||
|
cpCmd='cp ' + os.path.join(inps.master, 'data*') +' '+masterShelveDir
|
||||||
|
os.system(cpCmd)
|
||||||
|
pckfile = os.path.join(masterShelveDir,'data')
|
||||||
|
print(pckfile)
|
||||||
|
metadata = extractInfoFromPickle(pckfile, inps)
|
||||||
|
|
||||||
inps.master = os.path.dirname(inps.master)
|
|
||||||
cpCmd='cp ' + os.path.join(inps.master, 'data*') +' '+masterShelveDir
|
|
||||||
os.system(cpCmd)
|
|
||||||
pckfile = os.path.join(masterShelveDir,'data')
|
|
||||||
print(pckfile)
|
|
||||||
metadata = extractInfoFromPickle(pckfile, inps)
|
|
||||||
########
|
########
|
||||||
print ('unwrapping method : ' , inps.method)
|
print ('unwrapping method : ' , inps.method)
|
||||||
if inps.method == 'snaphu':
|
if inps.method == 'snaphu':
|
||||||
if inps.nomcf:
|
if inps.nomcf:
|
||||||
fncall = runUnwrap
|
fncall = runUnwrap
|
||||||
else:
|
else:
|
||||||
fncall = runUnwrapMcf
|
fncall = runUnwrapMcf
|
||||||
fncall(inps.intfile, inps.unwprefix + '_snaphu.unw', inps.cohfile, metadata, defomax=inps.defomax)
|
fncall(inps.intfile, inps.unwprefix + '_snaphu.unw', inps.cohfile, metadata, defomax=inps.defomax)
|
||||||
|
|
||||||
elif inps.method == 'snaphu2stage':
|
elif inps.method == 'snaphu2stage':
|
||||||
if inps.nomcf:
|
if inps.nomcf:
|
||||||
fncall = runUnwrap
|
fncall = runUnwrap
|
||||||
|
@ -319,11 +332,12 @@ def main(iargs=None):
|
||||||
fncall(inps.intfile, inps.unwprefix + '_snaphu.unw', inps.cohfile, metadata, defomax=inps.defomax)
|
fncall(inps.intfile, inps.unwprefix + '_snaphu.unw', inps.cohfile, metadata, defomax=inps.defomax)
|
||||||
|
|
||||||
# adding in the two-stage
|
# adding in the two-stage
|
||||||
runUnwrap2Stage(inps.unwprefix + '_snaphu.unw', inps.unwprefix + '_snaphu.unw.conncomp',inps.unwprefix + '_snaphu2stage.unw')
|
runUnwrap2Stage(inps.unwprefix + '_snaphu.unw',
|
||||||
|
inps.unwprefix + '_snaphu.unw.conncomp',
|
||||||
|
inps.unwprefix + '_snaphu2stage.unw')
|
||||||
|
|
||||||
elif inps.method == 'icu':
|
elif inps.method == 'icu':
|
||||||
runUnwrapIcu(inps.intfile, inps.unwprefix + '_icu.unw')
|
runUnwrapIcu(inps.intfile, inps.unwprefix + '_icu.unw')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue