Skip to content
Snippets Groups Projects
Commit ef4fbdaf authored by Alexander Kutkin's avatar Alexander Kutkin
Browse files

fix matplotlib version

parent ae30e160
Branches
No related tags found
No related merge requests found
Pipeline #52602 passed
...@@ -253,7 +253,7 @@ RUN wget -q -O /WSRT_Measures.ztar \ ...@@ -253,7 +253,7 @@ RUN wget -q -O /WSRT_Measures.ztar \
rm /WSRT_Measures.ztar rm /WSRT_Measures.ztar
# Some python stuff # Some python stuff
RUN python3 -m pip install h5py pandas pyyaml astropy matplotlib scipy shapely bdsf ipython radio_beam scikit-learn RUN python3 -m pip install h5py pandas pyyaml astropy matplotlib==3.5.2 scipy shapely bdsf ipython radio_beam scikit-learn
# cd /src && \ # cd /src && \
# git clone https://github.com/lofar-astron/PyBDSF.git && \ # git clone https://github.com/lofar-astron/PyBDSF.git && \
# cd /src/PyBDSF && \ # cd /src/PyBDSF && \
......
...@@ -27,9 +27,10 @@ def get_autocorr(tab, ant, avg='time', flagged=False): ...@@ -27,9 +27,10 @@ def get_autocorr(tab, ant, avg='time', flagged=False):
data[q.getcol('FLAG')] = np.nan data[q.getcol('FLAG')] = np.nan
if avg.lower() == 'time': if avg.lower() == 'time':
return abs(np.nanmean(data, axis=0)) return abs(np.nanmean(data, axis=0))
elif avg.lower().startswith('freq'): elif avg.lower().startswith('freq') and len(data.shape)==3:
print(data.shape)
return abs(np.nanmean(data, axis=1)) return abs(np.nanmean(data, axis=1))
elif avg.lower().startswith('pol'): elif avg.lower().startswith('pol') and len(data.shape)==3:
return abs(np.nanmean(data, axis=2)) return abs(np.nanmean(data, axis=2))
else: else:
logging.error('Unknown average keywodr, must be time/freq/pol...') logging.error('Unknown average keywodr, must be time/freq/pol...')
...@@ -99,8 +100,10 @@ def plot_autocorrs(ms, flagged=False): ...@@ -99,8 +100,10 @@ def plot_autocorrs(ms, flagged=False):
antname = antnames[i] antname = antnames[i]
avg_time = get_autocorr(tab, ant, avg='time', flagged=flagged) # TIME_AVG avg_time = get_autocorr(tab, ant, avg='time', flagged=flagged) # TIME_AVG
avg_freq = get_autocorr(tab, ant, avg='freq', flagged=flagged) # FREQ_AVG avg_freq = get_autocorr(tab, ant, avg='freq', flagged=flagged) # FREQ_AVG
if not isinstance(avg_time, np.ndarray) or not isinstance(avg_freq, np.ndarray):
continue
med_time_avgs.append(np.nanmedian(avg_time, axis=0)) med_time_avgs.append(np.nanmedian(avg_time, axis=0))
med_freq_avgs.append(np.nanmedian(avg_freq, axis=0)) med_freq_avgs.append(np.nanmedian(avg_freq, axis=1))
for fig, res in zip ([fig1, fig2], [avg_time, avg_freq]): for fig, res in zip ([fig1, fig2], [avg_time, avg_freq]):
ax = fig.add_subplot(ny, nx, i+1) ax = fig.add_subplot(ny, nx, i+1)
at = AnchoredText(antname, prop=dict(size=9), frameon=True, loc='upper left') at = AnchoredText(antname, prop=dict(size=9), frameon=True, loc='upper left')
......
...@@ -932,7 +932,7 @@ def main(img, resid, model, clustering_method='Voronoi', add_manual=False, nclus ...@@ -932,7 +932,7 @@ def main(img, resid, model, clustering_method='Voronoi', add_manual=False, nclus
# racen = f[0].header['CRVAL1'] # racen = f[0].header['CRVAL1']
# deccen = f[0].header['CRVAL2'] # deccen = f[0].header['CRVAL2']
fig = plt.figure(figsize=[12,12]) fig = plt.figure(figsize=[12,12])
ax = fig.add_subplot(1,1,1, projection=wcs.celestial) ax = fig.add_subplot(1,1,1, projection=wcs.celestial[0])
vmin, vmax = np.percentile(image_data, 5), np.percentile(image_data, 95) vmin, vmax = np.percentile(image_data, 5), np.percentile(image_data, 95)
ax.imshow(resid_data, vmin=vmin, vmax=vmax, origin='lower')#cmap='gray', vmin=2e-5, vmax=0.1)#, norm=LogNorm()) ax.imshow(resid_data, vmin=vmin, vmax=vmax, origin='lower')#cmap='gray', vmin=2e-5, vmax=0.1)#, norm=LogNorm())
...@@ -960,4 +960,5 @@ def main(img, resid, model, clustering_method='Voronoi', add_manual=False, nclus ...@@ -960,4 +960,5 @@ def main(img, resid, model, clustering_method='Voronoi', add_manual=False, nclus
### if __name__ == "__main__": ### if __name__ == "__main__":
if __name__ == "__main__": if __name__ == "__main__":
main(img, resid, model, clustering_method='Voronoi', nclusters=6) pass
# main(img, resid, model, clustering_method='Voronoi', nclusters=6)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment