Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PanelArray.show() displays same antenna orientation for different polarization types. #23

Closed
echacko opened this issue May 27, 2022 · 5 comments

Comments

@echacko
Copy link
Contributor

echacko commented May 27, 2022

Describe the bug
While plotting the panel array geometry using the PanelArray.show() function, the same antenna array is shown for both polarization type 'VH' and 'cross'. Ideally, the antenna orientation for cross polarization should be rotated by 45 degree w.r.t. polarization type 'VH.

To Reproduce

from sionna.channel.tr38901 import PanelArray

array = PanelArray(num_rows_per_panel = 4,
                   num_cols_per_panel = 4,
                   polarization = 'dual',
                   polarization_type = 'cross',
                   antenna_pattern = '38.901',
                   carrier_frequency = 3.5e9)

array.show()

Expected behavior
The plot when polarization type is set to 'cross' should be as below:
image

Proposed solution
The markers for antenna, when plotting figure with polarization type 'cross', should be rotated by 45 degrees.
Please find the modified PanelArray.show() function:

def show(self):
    """Show the panel array geometry"""
    marker_vert = MarkerStyle("|")
    marker_horz = MarkerStyle("_")
    if self._polarization == 'dual' and self._polarization_type == 'cross':
        marker_vert = MarkerStyle("|")
        marker_vert._transform.rotate_deg(-45)
        marker_horz = MarkerStyle("_")
        marker_horz._transform.rotate_deg(-45)

    fig = plt.figure()
    pos_pol1 = self._ant_pos_pol1
    plt.plot(pos_pol1[:,1], pos_pol1[:,2], marker = marker_vert,
        markeredgecolor='red', markersize="20", linestyle="None",
        markeredgewidth="2")
    for i, p in enumerate(pos_pol1):
        fig.axes[0].annotate(self._ant_ind_pol1[i].numpy()+1, (p[1], p[2]))
    if self._polarization == 'dual':
        pos_pol2 = self._ant_pos_pol2
        plt.plot(pos_pol2[:,1], pos_pol2[:,2], marker = marker_horz,
            markeredgecolor='black', markersize="20", linestyle="None",
            markeredgewidth="1")
    plt.xlabel("y (m)")
    plt.ylabel("z (m)")
    plt.title("Panel Array")
    plt.legend(["Polarization 1", "Polarization 2"], loc="upper right")
@faycalaa
Copy link
Collaborator

Hi,

Thank you for reporting this bug.

We could reproduce the error. The fix you have suggested seems to work fine for dual polarization, but always display vertical polarization for the single polarisation configuration.

Do you want to update your code and make a pull request?

@echacko
Copy link
Contributor Author

echacko commented May 27, 2022

Hi,

The original show() function displays antenna orientation as | irrespective of the polarization type in single polarization configuration.

I will update my code to fix this issue as well and then submit a pull request.

Thanks for pointing out the new error, I did not check with single polarization configuration.

@echacko
Copy link
Contributor Author

echacko commented May 27, 2022

Hi,

I have made the pull request.

Since this was my first pull request, hope I did everything right.

Thanks

@faycalaa
Copy link
Collaborator

Thank you.

We will review it and merge it.

@gmarcusm
Copy link
Collaborator

Thanks, fixed in 0.9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants