Skip to content

Commit

Permalink
remove codex-africanus from setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Apr 16, 2024
1 parent 07fcedd commit 5b542b0
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
8 changes: 7 additions & 1 deletion pfb/parser/spotless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ inputs:
dtype: float
default: 0.5
info:
Lower the initail rmsfactor by this amount
Lower the initial rmsfactor by this amount
diverge-count:
dtype: int
default: 5
info:
Will terminate the algorithm if the rms increases this many times.
Set to > niter to disable this check.

outputs:
{}
49 changes: 46 additions & 3 deletions pfb/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,14 @@ def _restore_corrs(vis, ncorr):
return model_vis


# model to fit
@jax.jit
def psf_errorsq(x, data, xy):
'''
Returns sum of square error for best fit Gaussian to data
'''
emaj, emin, pa = x
Smin = jnp.minimum(emaj, emin)
Smaj = jnp.maximum(emaj, emin)
# print(emaj, emin, pa)
A = jnp.array([[1. / Smin ** 2, 0],
[0, 1. / Smaj ** 2]])

Expand All @@ -519,7 +520,7 @@ def psf_errorsq(x, data, xy):
B = jnp.dot(jnp.dot(R.T, A), R)
Q = jnp.einsum('nb,bc,cn->n', xy.T, B, xy)
# GaussPar should corresponds to FWHM
fwhm_conv = 2 * jnp.sqrt(2 * np.log(2))
fwhm_conv = 2 * jnp.sqrt(2 * jnp.log(2))
model = jnp.exp(-fwhm_conv * Q)
res = data - model
return jnp.vdot(res, res)
Expand Down Expand Up @@ -1441,3 +1442,45 @@ def combine_columns(x, y, dc, dc1, dc2):
out=x,
casting='same_kind')
return x


# def fft_interp(image, cellxi, cellyi, nxo, nyo,
# cellxo, cellyo, shiftx, shifty):
# '''
# Use non-uniform fft to interpolate image in a flux conservative way

# image - input image
# cellxi - input x cell-size
# cellyi - input y cell-size
# nxo - number of x pixels in output
# nyo - number of y pixels in output
# cellxo - output x cell size
# cellyo - output y cell size
# shiftx - shift x coordinate by this amount
# shifty - shift y coordinate by this amount

# All sizes are assumed to be in radians.
# '''



# # coordinates on input grid
# nx, ny = image.shape
# x = np.arange(-(nx//2), nx//2) * cellxi
# y = np.arange(-(ny//2), ny//2) * cellyi
# xx, yy = np.meshgrid(x, y, indexing='ij')

# # frequencies on output grid
# celluo = 1/(nxo*cellxo)
# cellvo = 1/(nyo*cellyo)
# uo = np.arange(-(nxo//2), nxo//2) * celluo/nxo
# vo = np.arange(-(nyo//2), nyo//2) * cellvo/nyo

# uu, vv = np.meshgrid(uo, vo, indexing='ij')
# uv = np.vstack((uo, vo)).T


# res1 = finufft.nufft2d3(xx.ravel(), yy.ravel(), image.ravel(), uu.ravel(), vv.ravel())



4 changes: 3 additions & 1 deletion pfb/workers/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ def grid(**kw):
from daskms.fsspec_store import DaskMSStore
if opts.xds is not None:
xdsstore = DaskMSStore(opts.xds.rstrip('/'))
xdsname = opts.xds
else:
xdsstore = DaskMSStore(f'{basename}.xds')
xdsname = f'{basename}.xds'
try:
assert xdsstore.exists()
except Exception as e:
raise ValueError(f"There must be an xds at {opts.xds}. "
raise ValueError(f"There must be an xds at {xdsname}. "
f"Original traceback {e}")
opts.xds = xdsstore.url
OmegaConf.set_struct(opts, True)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"streamjoy",
"tbb",
"jax[cpu]",
"codex-africanus[complete]"
"@git+https://github.com/ratt-ru/codex-africanus.git"
"@master"
# "codex-africanus[complete]"
# "@git+https://github.com/ratt-ru/codex-africanus.git"
# "@master"
]


Expand Down

0 comments on commit 5b542b0

Please sign in to comment.