Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add snaphu2.0.4 support #313

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 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
3 changes: 3 additions & 0 deletions contrib/Snaphu/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ envSnaphu = envcontrib.Clone()
project = 'Snaphu'
package = envSnaphu['PACKAGE']
envSnaphu['PROJECT'] = project
if "-O2" in envSnaphu['CCFLAGS']: envSnaphu['CCFLAGS'].remove('-O2')
envSnaphu.Append(CCFLAGS=['-O3'])
Export('envSnaphu')


bindingsScons = os.path.join('bindings','SConscript')
SConscript(bindingsScons,variant_dir = os.path.join(envSnaphu['PRJ_SCONS_BUILD'],package,project,'bindings'))

Expand Down
107 changes: 105 additions & 2 deletions contrib/Snaphu/Snaphu.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,63 @@
doc='Image width'
)

####################################

NTILEROW = Component.Parameter(
'ntilerow',
public_name='NTILEROW',
default=None,
type=int,
mandatory=True,
intent='input',
doc='NTileRow'
)
NTILECOL = Component.Parameter(
'ntilecol',
public_name='NTILECOL',
default=None,
type=int,
mandatory=True,
intent='input',
doc='NTileCol'
)

ROWOVERLAP = Component.Parameter(
'rowovrlp',
public_name='COLOVERLAP',
default=None,
type=int,
mandatory=True,
intent='input',
doc='ROW OVERLAP'
)
COLOVERLAP = Component.Parameter(
'colovrlp',
public_name='COLOVERLAP',
default=None,
type=int,
mandatory=True,
intent='input',
doc='COLUMN OVERLAP'
)
NTHREADS = Component.Parameter(
'nthreads',
public_name='NTHREADS',
default=None,
type=int,
mandatory=True,
intent='input',
doc='NTHREADS'
)





###################################



class Snaphu(Component):

parameter_list = (
Expand All @@ -263,7 +320,10 @@ class Snaphu(Component):
AZIMUTH_LOOKS,
INIT_METHOD,
COSTMODE,
INT_FILE_FORMAT
INT_FILE_FORMAT,
NTILEROW,NTILECOL,
ROWOVERLAP,COLOVERLAP,
NTHREADS
)

"""The Snaphu cost unwrapper"""
Expand Down Expand Up @@ -358,6 +418,29 @@ def setMaxComponents(self, num):
"""Set the maximum number of connected components."""
self.maxComponents = num


#############################

def setNTileRow(self,nrow):
self.ntilerow = nrow

def setNTileCol(self,ncol):
self.ntilecol = ncol

def setRowOverlap(self,rowovrlp):
self.rowovrlp=rowovrlp

def setColOverlap(self,colovrlp):
self.colovrlp=colovrlp

def setNThreads(self,nthreads):
self.nthreads=nthreads

#############################




def prepare(self):
"""Perform some initialization of defaults"""

Expand Down Expand Up @@ -397,7 +480,27 @@ def prepare(self):
snaphu.setIntFileFormat_Py( int(self.fileFormats[self.intFileFormat]))
snaphu.setCorFileFormat_Py( int(self.fileFormats[self.corFileFormat]))
snaphu.setUnwFileFormat_Py( int(self.fileFormats[self.unwFileFormat]))



###################

if self.ntilerow is not None:
snaphu.setNTileRow_Py(self.ntilerow)

if self.ntilecol is not None:
snaphu.setNTileCol_Py(self.ntilecol)

if self.rowovrlp is not None:
snaphu.setRowOverlap_Py(self.rowovrlp)

if self.colovrlp is not None:
snaphu.setColOverlap_Py(self.colovrlp)

if self.nthreads is not None:
snaphu.setNThreads_Py(self.nthreads)


##########

def unwrap(self):
"""Unwrap the interferogram"""
Expand Down
74 changes: 74 additions & 0 deletions contrib/Snaphu/bindings/snaphumodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,77 @@ PyObject *setCorFileFormat_C(PyObject *self, PyObject *args)
infile->corrfileformat = flag;
return Py_BuildValue("i",0);
}


//////////////////////////////////////////////
// Author: Jun-Yan Chen, 20210711
//
// Adding Object for TileRow and TileCol
// Change file: snaphumodule.cpp, snaphumodule.h,
// Snaphu.py
//
PyObject *setNTileRow_C(PyObject *self, PyObject *args)
{
int nrow;
if(!PyArg_ParseTuple(args,"i", &nrow))
{
return NULL;
}
params->ntilerow = nrow;

return Py_BuildValue("i",0);
}

PyObject *setNTileCol_C(PyObject *self, PyObject *args)
{
int ncol;
if(!PyArg_ParseTuple(args,"i", &ncol))
{
return NULL;
}
params->ntilecol = ncol;

return Py_BuildValue("i",0);
}


PyObject *setRowOverlap_C(PyObject *self, PyObject *args)
{
int flag;
if(!PyArg_ParseTuple(args,"i", &flag))
{
return NULL;
}
params->rowovrlp = flag;

return Py_BuildValue("i",0);
}

PyObject *setColOverlap_C(PyObject *self, PyObject *args)
{
int flag;
if(!PyArg_ParseTuple(args,"i", &flag))
{
return NULL;
}
params->colovrlp = flag;

return Py_BuildValue("i",0);
}

PyObject *setNThreads_C(PyObject *self, PyObject *args)
{
int flag;
if(!PyArg_ParseTuple(args,"i", &flag))
{
return NULL;
}
params->nthreads = flag;

return Py_BuildValue("i",0);
}





Loading