radiationpatterns.jl

RadiationPatterns.jl is a Julia package designed for visualizing radiation patterns using PlotlyJS.jl.

https://github.com/jake-w-liu/radiationpatterns.jl

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary

Keywords

julia plotlyjs
Last synced: 6 months ago · JSON representation ·

Repository

RadiationPatterns.jl is a Julia package designed for visualizing radiation patterns using PlotlyJS.jl.

Basic Info
  • Host: GitHub
  • Owner: jake-w-liu
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Homepage:
  • Size: 771 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 12
Topics
julia plotlyjs
Created over 1 year ago · Last pushed 9 months ago
Metadata Files
Readme License Citation

README.md

RadiationPatterns.jl

Build Status

RadiationPatterns.jl is a Julia package designed for visualizing radiation patterns using PlotlyJS.jl and PlotlySupply.jl. The package provides functions for creating 2D and 3D plots of radiation patterns, as well as calculating directivity. I hope to confine the settings of the plots to the essential ones using keywords. However, if further modifications are needed, one can always use the API provided by PlotlyJS.jl (such as update!) to modify the figures returned by the API provided by this package (SyncPlot objects are returned in the functions).

illus1

illus2

I use this package in my publications and would be delighted if you could cite it in your work. Thank you for your support!

Data Structure

Pattern

A Pattern object contains the radiation pattern data:

julia mutable struct Pattern{T1<:Number,T2<:Real} U::Union{Array{T1,2}, SubArray{T1,2}, LinearAlgebra.Transpose{T1}} x::Vector{T2} y::Vector{T2} end

where U is a 2D meshgrid data representing the radiation pattern with x as the coordinate for the first dimension and y as the coordinate for the second dimension. The data structure is arranged as the following figure:

illus3

The following example creates a dipole radiation pattern:

```julia tht = collect(-180:180) phi = collect(0:180)

_, T = meshgrid(phi, tht) # uses MeshGrid.jl U = sind.(T).^2 Pat = Pattern(U, tht, phi) ```

The convention for x associating with theta in degrees and y associating with phi in degrees is used throughout when creating patterns in spherical coordinates.

Functions

Funtions start with ptn_ are used to plot Pattern object directly. In the following, keyword default value with 0 (or [0, 0] in ranges) means not specifying these keywords in the plotly plots.


The following functions create pattern plots from the Pattern object. Currently 2D patterns, 3D patterns, and holograms (can be used to plot a slice of field distributions) are supported. To understand the usage, one can also look up PlotlySupply.jl for reference.

ptn_2d

julia ptn_2d( Pat::Union{Pattern,Vector{<:Pattern}}; ind::Union{Int,Vector{Int}} = 1, dims::Union{Int,Vector{Int}} = 1, type::String = "normal", xlabel::String = "", ylabel::String = "", xrange::Vector{<:Real} = [0, 0], yrange::Vector{<:Real} = [0, 0], trange::Vector{<:Real} = [0, 0], rrange::Vector{<:Real} = [0, 0], width::Real = 0, height::Real = 0, mode::Union{String,Vector{String}} = "lines", dash::Union{String,Vector{String}} = "", color::Union{String,Vector{String}} = "", legend::Union{String,Vector{String}} = "", )

Plots a 2D radiation pattern by setting the keywords ind and dim. For example, setting dim=1 takes the slice of U[:, ind], and setting dim=2 takes the slice of U[ind, :]. Can be used for comparing two or more patterns also (see the example ex_basics.jl and ex_horn.jl). When comparing two or more pattern cuts, one can specify different ind, dims, mode, dash, color and legend by setting these keywords as vectors (if not set, default values are used).

Arguments

  • Pat: A Pattern or a vector of Patterns
  • ind: Index to slice the pattern (default: 1)
  • dims: Dimension to slice the pattern, either 1 or 2 (default: 1)
  • type: Plot type, either "normal" or "polar" (default: "normal")
  • xlabel: Label for the x-axis (default: "")
  • ylabel: Label for the y-axis (default: "")
  • xrange: Range for the x-axis (default: [0, 0])
  • yrange: Range for the y-axis (default: [0, 0])
  • trange: Range for the angular axis (default: [0, 0])
  • rrange: Range for the radial axis (default: [0, 0])
  • width: Width of the plot (default: 0)
  • height: Height of the plot (default: 0)
  • mode: Plotting mode (default: "lines")
  • dash: Dash setting (default: "")
  • color: Color of the plot lines (default: "")
  • legend: legend of the plot lines (default: "")

ptn_3d

julia ptn_3d(Pat::Pattern; dB::Bool = false, thr::Real = -50)

Plots a 3D radiation pattern. In 3D cases, Pat.x should be theta values in degrees, and Pat.y should be phi values in degrees. If dB scale is used for the data, please set the keyword dB to true. A threadsold value thr (max difference from the maximum value of the pattern) is used in case that -Inf appears in the dB scale data.

Arguments

  • Pat: A Pattern
  • dB: Boolean to plot if the pattern is in decibels (default: false)
  • thr: Threshold value for the plot if dB is true (default: -50)

ptn_holo

julia ptn_holo( Pat::Pattern; xlabel::String = "", ylabel::String = "", zrange::Vector{<:Real} = [0, 0], ref_size = 500, colorscale = "Jet", )

Plots a holographic (heatmap) radiation pattern. Currently I have issues in setting both the axis ratio and the range of the heatmap plot. In order to have an 1:1 aspect ratio, I have tried to fine tune the width and height of the plot. One can try to adjust the ref_size keyword to set the figure size. I hope that more improvements can be made in the future.

Arguments

  • Pat: A Pattern
  • xlabel: Label for the x-axis (default: "")
  • ylabel: Label for the y-axis (default: "")
  • zrange: Range for the z-axis (default: [0, 0])
  • ref_size: ref size of the plot in pixels (default: 500)
  • colorscale: Color scale for the heatmap (default: "Jet")

The following are functionalities to calculate directivity of a pattern. Trapz.jl is used for integration. Noted that Pat.x represents the theta axis and Ptn.y represents the phi axis.

direc_ptn

julia direc_ptn(Pat::Pattern)

Calculate the directivity pattern of a radiation pattern. Pat.x should be theta values in degrees, and Pat.y should be phi values in degrees.

Arguments

  • Pat: A Pattern

Returns

A Pattern representing the directivity.

direc

julia direc(Pat::Pattern)

Calculates the directivity of a radiation pattern. Pat.x should be theta values in degrees, and Pat.y should be phi values in degrees.

Arguments

  • Pat: A Pattern

Returns

The directivity value.

db_ptn

julia db_ptn(Pat::Pattern, topower=false)

Transform Pattern object to dB Pattern, return a new Pattern object.

Arguments

  • Pat: A Pattern
  • topower: if ture, then uses 20log10(.), otherwise 10log10(.).

Returns

The dB Pattern object.

db_ptn!

julia db_ptn!(Pat::Pattern, topower=false)

Transform Pattern object to dB Pattern.

Arguments

  • Pat: A Pattern
  • topower: if ture, then uses 20log10(.), otherwise 10log10(.).

Examples

Please refer to the example folder for more illustrations.

Citation (CITATION.cff)

abstract: RadiationPatterns.jl is a Julia package designed for visualizing radiation patterns using PlotlyJS.jl.
authors:
  - family-names: Liu
    given-names: Jake W.
    orcid: "https://orcid.org/0000-0001-5458-7917"
cff-version: 1.2.0
date-released: "2024-08-08"
identifiers:
  - type: url
    value: "https://github.com/akjake616/RadiationPatterns.jl"
    description: Latest version
keywords:
  - research
  - "detection repackaged Android applications"
  - "resouce files"
license: MIT
message: If you use this software, please cite it using these metadata.
repository-code: "https://github.com/akjake616/RadiationPatterns.jl"
title: RadiationPatterns.jl

GitHub Events

Total
  • Release event: 4
  • Issue comment event: 13
  • Push event: 4
  • Pull request event: 1
  • Create event: 5
Last Year
  • Release event: 4
  • Issue comment event: 13
  • Push event: 4
  • Pull request event: 1
  • Create event: 5

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 2
  • Total pull requests: 0
  • Average time to close issues: less than a minute
  • Average time to close pull requests: N/A
  • Total issue authors: 2
  • Total pull request authors: 0
  • Average comments per issue: 19.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: less than a minute
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 19.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (1) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 14
juliahub.com: RadiationPatterns

RadiationPatterns.jl is a Julia package designed for visualizing radiation patterns using PlotlyJS.jl.

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 3.2%
Average: 9.8%
Dependent packages count: 16.3%
Last synced: 6 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • julia-actions/cache v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v2 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite