Skip to content

Commit

Permalink
fix log messages for ref_phs and aps
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Garthwaite authored and Matt Garthwaite committed Jun 25, 2020
1 parent 1241ec7 commit 8b4fee0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
16 changes: 8 additions & 8 deletions pyrate/core/aps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
signals.
"""
# pylint: disable=invalid-name, too-many-locals, too-many-arguments
import logging
import os
from copy import deepcopy
from collections import OrderedDict
import numpy as np
from numpy import isnan
from scipy.fftpack import fft2, ifft2, fftshift, ifftshift
from scipy.interpolate import griddata
from pyrate.core.logger import pyratelogger as log

from pyrate.core import shared, ifgconstants as ifc, mpiops, config as cf
from pyrate.core.covariance import cvd_from_phase, RDist
Expand All @@ -35,16 +35,16 @@
from pyrate.core.timeseries import time_series
from pyrate.merge import assemble_tiles

log = logging.getLogger(__name__)


def wrap_spatio_temporal_filter(ifg_paths, params, tiles, preread_ifgs):
"""
A wrapper for the spatio-temporal filter so it can be tested.
See docstring for spatio_temporal_filter.
"""
if not params[cf.APSEST]:
log.info('APS correction not required.')
if params[cf.APSEST]:
log.info('Doing APS spatio-temporal filtering')
else:
log.info('APS spatio-temporal filtering not required')
return

# perform some checks on existing ifgs
Expand Down Expand Up @@ -186,7 +186,7 @@ def spatial_low_pass_filter(ts_lp, ifg, params):
:return: ts_hp: filtered time series data of shape (ifg.shape, n_epochs)
:rtype: ndarray
"""
log.info('Applying APS spatial low-pass filter')
log.info('Applying spatial low-pass filter')
if params[cf.SLPF_NANFILL] == 0:
ts_lp[np.isnan(ts_lp)] = 0 # need it here for cvd and fft
else:
Expand Down Expand Up @@ -283,7 +283,7 @@ def temporal_low_pass_filter(tsincr, epochlist, params):
:return: tsfilt_incr: filtered time series data, shape (ifg.shape, nepochs)
:rtype: ndarray
"""
log.info('Applying APS temporal low-pass filter')
log.info('Applying temporal low-pass filter')
nanmat = ~isnan(tsincr)
tsfilt_incr = np.empty_like(tsincr, dtype=np.float32) * np.nan
intv = np.diff(epochlist.spans) # time interval for the neighboring epoch
Expand All @@ -300,7 +300,7 @@ def temporal_low_pass_filter(tsincr, epochlist, params):
func = mean_filter

_tlpfilter(cols, cutoff, nanmat, rows, span, threshold, tsfilt_incr, tsincr, func)
log.debug("Finished applying temporal low pass filter")
log.debug("Finished applying temporal low-pass filter")
return tsfilt_incr

# Throwaway function to define Gaussian filter weights
Expand Down
3 changes: 2 additions & 1 deletion pyrate/core/ref_phs_est.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def _inner(ifg_paths):
for ifg in ifgs:
_update_phase_metadata(ifg)
ifg.close()

return ref_phs

process_ifgs_paths = mpiops.array_split(ifg_paths)
Expand Down Expand Up @@ -181,7 +182,7 @@ def _est_ref_phs_method1(phase_data, comp):
def _update_phase_metadata(ifg):
ifg.meta_data[ifc.PYRATE_REF_PHASE] = ifc.REF_PHASE_REMOVED
ifg.write_modified_phase()
log.info(f"Reference phase removed for {ifg.data_path}")
log.debug(f"Reference phase corrected for {ifg.data_path}")


class ReferencePhaseError(Exception):
Expand Down
6 changes: 3 additions & 3 deletions pyrate/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ def _ref_phase_estimation(ifg_paths, params, refpx, refpy):
"""
Wrapper for reference phase estimation.
"""
log.info("Calculating reference phase")
log.info("Calculating reference phase and correcting each interferogram")
if len(ifg_paths) < 2:
raise rpe.ReferencePhaseError(
"At least two interferograms required for reference phase correction ({len_ifg_paths} "
"provided).".format(len_ifg_paths=len(ifg_paths))
)

if mpiops.run_once(shared.check_correction_status, ifg_paths, ifc.PYRATE_REF_PHASE):
log.debug('Finished reference phase estimation')
log.debug('Finished reference phase correction')
return

if params[cf.REF_EST_METHOD] == 1:
Expand All @@ -241,7 +241,7 @@ def _ref_phase_estimation(ifg_paths, params, refpx, refpy):
np.save(file=ref_phs_file, arr=collected_ref_phs)
else:
mpiops.comm.Send(ref_phs, dest=MASTER_PROCESS, tag=mpiops.rank)
log.debug('Finished reference phase estimation')
log.debug('Finished reference phase correction')

# Preserve old return value so tests don't break.
if isinstance(ifg_paths[0], Ifg):
Expand Down

0 comments on commit 8b4fee0

Please sign in to comment.