Skip to content

Commit

Permalink
Merge pull request #4 from bennahugo/0.2dev3
Browse files Browse the repository at this point in the history
Prepare 0.2dev3
  • Loading branch information
mhardcastle authored Dec 22, 2017
2 parents f12956d + 1f025bf commit a56a032
Show file tree
Hide file tree
Showing 36 changed files with 1,558 additions and 1,085 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# emacs backups
*~

# Object files
*.o
*.ko
Expand Down
2 changes: 1 addition & 1 deletion DDFacet/Array/NpShared.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def CreateShared(Name, shape, dtype):
def ToShared(Name, A):

a = CreateShared(Name, A.shape, A.dtype)
a[:] = A[:]
np.copyto(a,A)
return a

def DelArray(Name):
Expand Down
25 changes: 1 addition & 24 deletions DDFacet/DDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,11 @@
from DDFacet.Other import progressbar
from DDFacet.Other.AsyncProcessPool import APP, WorkerProcessError
import DDFacet.cbuild.Gridder._pyArrays as _pyArrays
from DDFacet.version import __version__
from DDFacet.report_version import report_version
log = None
# from version import __version__

import numpy as np

def report_version():
# perhaps we are in a github with tags; in that case return describe
path = os.path.dirname(os.path.abspath(__file__))
try:
# work round possible unavailability of git -C
result = subprocess.check_output('cd %s; git describe --tags' % path, shell=True, stderr=subprocess.STDOUT).rstrip()
except subprocess.CalledProcessError:
result = None
if result is not None:
# will succeed if tags exist
return result
else:
# perhaps we are in a github without tags? Cook something up if so
try:
result = subprocess.check_output('cd %s; git rev-parse --short HEAD' % path, shell=True, stderr=subprocess.STDOUT).rstrip()
except subprocess.CalledProcessError:
result = None
if result is not None:
return __version__+'-'+result
else:
# we are probably in an installed version
return __version__

# # ##############################
# # Catch numpy warning
Expand Down
8 changes: 5 additions & 3 deletions DDFacet/Data/ClassBeamMean.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def StackBeam(self,ThisMSData,iDir):
A1s=A1[ind]
fs=flags[ind]
Ws=W[ind]
MSnchan=Ws.shape[1]
T.timeit("1")

nd,na,nch,_,_=J.shape
Expand Down Expand Up @@ -172,7 +173,8 @@ def StackBeam(self,ThisMSData,iDir):

WW=Ws**2
T.timeit("4")
WW=WW.reshape((1,ind.size,self.MS.Nchan))
print>>log, 'WW.shape is', WW.shape
WW=WW.reshape((1,ind.size,MSnchan))
T.timeit("5")
JJsq=WW*JJ**2
T.timeit("6")
Expand All @@ -188,8 +190,8 @@ def StackBeam(self,ThisMSData,iDir):
for iBand in range(self.VS.NFreqBands):
indFreqBand,=np.where(ChanToFreqBand==iBand)
if indFreqBand.size==0: continue
self.StackedBeamDict[iDir]["SumJJsq"][iBand]+=np.sum(SumWsqThisRange.reshape((self.MS.Nchan,))[indFreqBand])
self.StackedBeamDict[iDir]["SumWsq"][iBand]+=np.sum(SumWsq.reshape((self.MS.Nchan,))[indFreqBand])
self.StackedBeamDict[iDir]["SumJJsq"][iBand]+=np.sum(SumWsqThisRange.reshape((MSnchan,))[indFreqBand])
self.StackedBeamDict[iDir]["SumWsq"][iBand]+=np.sum(SumWsq.reshape((MSnchan,))[indFreqBand])

#print SumWsq,self.SumWsq,self.SumJJsq.shape,J0.shape
T.timeit("9")
Expand Down
2 changes: 1 addition & 1 deletion DDFacet/Gridder/Arrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static PyMethodDef _pyArrays_testMethods[] = {
{"pyWhereMax", pyWhereMax, METH_VARARGS},
{"pyWhereMaxMask", pyWhereMaxMask, METH_VARARGS},
{"pySetOMPNumThreads", pySetOMPNumThreads, METH_VARARGS},
{"pySetOMPDynamicNumThreads", pySetOMPNumThreads, METH_VARARGS},
{"pySetOMPDynamicNumThreads", pySetOMPDynamicNumThreads, METH_VARARGS},
{NULL, NULL} /* Sentinel - marks the end of this structure */
};

Expand Down
4 changes: 1 addition & 3 deletions DDFacet/Gridder/Arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,4 @@ static PyObject *pyDivArray(PyObject *self, PyObject *args);
static PyObject *pyWhereMax(PyObject *self, PyObject *args);
static PyObject *pyWhereMaxMask(PyObject *self, PyObject *args);
static PyObject *pySetOMPNumThreads(PyObject *self, PyObject *args);



static PyObject *pySetOMPDynamicNumThreads(PyObject *self, PyObject *args);
2 changes: 1 addition & 1 deletion DDFacet/Gridder/JonesServer.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void GiveJones(float complex *ptrJonesMatrices, int *JonesDims, float *ptrCoefs,
if(ptrCoefs[idir]==0){continue;}
size_t offJ0=i_t*nd_Jones*na_Jones*nch_Jones*4
+i_dir*na_Jones*nch_Jones*4
+i_ant0*nch_Jones*4;
+i_ant0*nch_Jones*4
+iChJones*4;

float coef;
Expand Down
4 changes: 3 additions & 1 deletion DDFacet/Imager/ClassCasaImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
log= MyLogger.getLogger("ClassCasaImage")
from astropy.io import fits
from astropy.wcs import WCS
from DDFacet.report_version import report_version

def FileToArray(FileName,CorrT):
""" Read a FITS FileName file to an array """
Expand Down Expand Up @@ -79,9 +80,10 @@ def __init__(self,ImageName,ImShape,Cell,radec,Freqs=None,KeepCasa=False,Stokes=
self.imageFlipped = False
self.createScratch()
# Fill in some standard keywords
self.header['ORIGIN'] = 'DDFacet'
self.header['ORIGIN'] = 'DDFacet '+report_version()
self.header['BTYPE'] = 'Intensity'
self.header['BUNIT'] = 'Jy/beam'
self.header['SPECSYS'] = 'TOPOCENT'
if header_dict is not None:
for k in header_dict:
self.header[k]=header_dict[k]
Expand Down
2 changes: 1 addition & 1 deletion DDFacet/Imager/ClassDDEGridMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def __init__(self,
# Npix=Npix*2

Precision = GD["RIME"]["Precision"]
PolMode = GD["RIME"]["PolMode"]
PolMode = ExpectedOutputStokes

if Precision == "S":
self.dtype = np.complex64
Expand Down
Loading

0 comments on commit a56a032

Please sign in to comment.