<jupyter_start><jupyter_text>Array Lay-Out<jupyter_code>locs = pandas.read_csv(array_path + "chord_dish_coords_fences_wgap_clean.txt" , header=None, names=["x", "y"], sep=" ")
locs.head()
fig, ax = plt.subplots(figsize=(10,10))
ax = seaborn.scatterplot(locs.x, locs.y)
ax.set_aspect('equal')
#shift all coordinate to not be absurdly large
locs = locs - locs.median()
quads1 = locs.loc[(locs['x']<-25) & (locs['y']>20) ]
quads2 = locs.loc[(locs['x']>-25) & (locs['y']>20) ]
quads3 = locs.loc[(locs['x']<-25) & (locs['y']<20) ]
quads4 = locs.loc[(locs['x']>-25) & (locs['y']<20) ]
fig = plt.figure(constrained_layout=True, figsize=(15, 8))
spec = gridspec.GridSpec(ncols=3, nrows=2, figure=fig)

ax1 = fig.add_subplot(spec[:, 0])
ax2 = fig.add_subplot(spec[0, 1])
ax3 = fig.add_subplot(spec[0, 2], sharey = ax2)
ax4 = fig.add_subplot(spec[1, 1], sharex = ax2)
ax5 = fig.add_subplot(spec[1, 2], sharey = ax4)

seaborn.scatterplot(x=locs.x, y=locs.y, ax=ax1)
seaborn.scatterplot(x=quads1.x, y=quads1.y, ax=ax2)
seaborn.scatterplot(x=quads2.x, y=quads2.y, ax=ax3)
seaborn.scatterplot(x=quads3.x, y=quads3.y, ax=ax4)
seaborn.scatterplot(x=quads4.x, y=quads4.y, ax=ax5)
#ax = seaborn.scatterplot(quads2.x, quads2.y)
ax1.set_aspect('equal')
ax2.set_aspect('equal')
ax3.set_aspect('equal')
ax4.set_aspect('equal')
ax5.set_aspect('equal')

#Rename and reshape to match pyuvsim input: Name Number   BeamID   E          N          U
def reformat(locations):
    new_df = locations.copy()
    new_df["Number"] = numpy.arange(0,new_df.shape[0],1)
    new_df['Name'] = new_df["Number"].astype(str)
    new_df['BeamID'] = 0
    new_df['U'] = 0
    new_df.rename(columns = {'x':'E', 'y':'N'}, inplace = True)
    new_df = new_df[["Name", "Number", "BeamID", "E", "N", "U"]]
    return new_df

full_chord = reformat(locs)
q1_chord = reformat(quads1)
q2_chord = reformat(quads2)
q3_chord = reformat(quads3)
q4_chord = reformat(quads4)


path = "/Users/ronniyjoseph/Sync/MSI_Fellowship/CHORD/Array_Layout/"
full_chord.to_csv(path+ "chord_wgap_full_2020_10.txt", sep='\t', index=False)
q1_chord.to_csv(path+ "chord_wgap_q1_2020_10.txt", sep='\t', index=False)
q2_chord.to_csv(path+ "chord_wgap_q2_2020_10.txt", sep='\t', index=False)
q3_chord.to_csv(path+ "chord_wgap_q3_2020_10.txt", sep='\t', index=False)
q4_chord.to_csv(path+ "chord_wgap_q4_2020_10.txt", sep='\t', index=False)<jupyter_output><empty_output><jupyter_text>Beam Map<jupyter_code>phi = numpy.load(beam_path + "/45deg_20m_cable/all_phi.npy")/180*numpy.pi
theta = numpy.load(beam_path + "/45deg_20m_cable/all_theta.npy")/180*numpy.pi
freqs = numpy.load(beam_path + "/45deg_20m_cable/all_freqs.npy")
cst_beams = numpy.load(beam_path +"/45deg_20m_cable/all_beams.npy")
print(phi.shape ,theta.shape ,freqs.shape ,beams.shape)
print(len(numpy.unique(phi)),len(numpy.unique(theta))) 

import healpy 
import pyuvsim

def healpy_plotting(tt, pp, tile_response):
    nside =32
    n_pixels = healpy.nside2npix(nside)
    
    indices = healpy.ang2pix(nside, tt.flatten(), pp.flatten())
    healpixmap = numpy.zeros((n_pixels), dtype=complex)

    healpixmap[indices] += tile_response.flatten()

    healpy.orthview(20*numpy.log10(numpy.abs(healpixmap)), rot =[0,90,180], half_sky=True, norm='none')
    healpy.graticule()
healpy_plotting(theta, phi, cst_beams[0,:]/cst_beams[0,:].max())
print(theta.min(),theta.max())
print(phi.min(), phi.max())
airy_disk = pyuvsim.AnalyticBeam(type='airy', diameter=4.5)
airy_disk.efield_to_power()
airy_beam = airy_disk.interp(phi[0,:181],theta[0,:181],freqs*1e9)[0][0,0,0,0,:]

gaussian = pyuvsim.AnalyticBeam(type='gaussian', diameter=4.5)
gaussian.efield_to_power()
gauss_beam = gaussian.interp(phi[0,:181],theta[0,:181],freqs*1e9)[0][0,0,0,0,:]

plt.plot(numpy.degrees(theta[0,:181]),10*numpy.log10(abs(cst_beams[0,0,:181])/abs(cst_beams[0,0,:181]).max()))
plt.plot(numpy.degrees(theta[0,:181]),10*numpy.log10(abs(airy_beam)))
plt.plot(numpy.degrees(theta[0,:181]),10*numpy.log10(abs(gauss_beam)))
plt.ylim(-80,0)<jupyter_output><empty_output><jupyter_text>Bug Report<jupyter_code>import pyuvsim
import numpy as np

phi = np.linspace(0,np.pi,5)
theta = np.linspace(0,np.pi/2,6)
freqs = np.linspace(135,165,7)*1e6

pp,tt = np.meshgrid(phi,theta)
uniform = pyuvsim.AnalyticBeam(type='uniform')
uniform.efield_to_power()
uniform_beam = airy_disk.interp(pp, tt, freqs)
airy_disk = pyuvsim.AnalyticBeam(type='airy', diameter=4.5)
airy_disk.efield_to_power()
airy_beam = airy_disk.interp(pp, tt, freqs)
gaussian = pyuvsim.AnalyticBeam(type='gaussian', diameter=6)
gaussian.efield_to_power()
gauss_beam = gaussian.interp(pp,tt,freqs)

ppf,ff = np.meshgrid(pp,freqs)
pp.shape<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.188743847635352, 'fraction_numerical': 0.052000855981168416, 'mean_word_length': 6.803005008347245, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '338021', 'license': 'MIT', 'n_tokens_mistral': 2260, 'n_tokens_neox': 2132, 'n_words': 266, 'path': 'CHORD-basics.ipynb', 'repo_name': 'ronniyjoseph/Arpeggio', 'size': '4673'}