Coder Social home page Coder Social logo

cmichelenstrofer / dimensionfulangles.jl Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 5.0 803 KB

๐Ÿ“ An extension of Unitful.jl to include angles as a dimension.

Home Page: https://cmichelenstrofer.github.io/DimensionfulAngles.jl/stable

License: MIT License

Julia 100.00%
angle julia julia-language unitful units units-of-measure

dimensionfulangles.jl's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ I work on marine renewable energy ๐ŸŒŠ๐ŸŒŠ๐ŸŒŠ as a research software engineer
  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on data-driven methods for marine renewable energy applications
  • ๐ŸŒฑ Iโ€™m currently learning the Julia language
  • ๐Ÿ˜„ Pronouns: he/him/รฉl
  • ๐Ÿ‘๐Ÿพ Inclusion and outreach efforts in marine renewable energy

dimensionfulangles.jl's People

Contributors

allcontributors[bot] avatar bc0n avatar cmichelenstrofer avatar dandeepphase avatar devel-chm avatar github-actions[bot] avatar kristofferc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dimensionfulangles.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

๐Ÿš€ Feature Request: DefaultSymbols variant

Feature Request

Unitful has a submodule that allows spamming lots of types into active environment, eliminating the need for the u" " syntax.

using Unitful
using Unitful.DefaultSymbols
a = 5mm

A variant of that code (perhaps DimensionfulAngles.DefaultSymbols) would be another usage variant (similar to # 3 in the readme.md), that would operate like Unitful, but with dimensions. What I'm thinking is to replicate that module, but export dimensionful angles in place of the non-dimensional angles from Unitful. Then it would be almost the same as using Unitful directly, but with the benefit of a dimension behind the scenes. It feels a bit cheating... like almost type piracy? but it is explicitly called and requires the submodule to be used, so should be safe from a code perspective.

The module is in
https://github.com/PainterQubits/Unitful.jl/blob/5cf162734af3c90c16425346d9f0d020d19f23f3/src/pkgdefaults.jl#L711-L731. I see degrees in the last two lines, but not sure where rad and sr are imported.

baremodule DefaultSymbols
    import Unitful

    for u in (:๐‹,:๐Œ,:๐“,:๐ˆ,:๐šฏ,:๐‰,:๐)
        Core.eval(DefaultSymbols, Expr(:import, Expr(:(.), :Unitful, u)))
        Core.eval(DefaultSymbols, Expr(:export, u))
    end

    for p in Unitful.si_prefixes
        for u in Unitful.si_no_prefix
            Core.eval(DefaultSymbols, Expr(:import, Expr(:(.), :Unitful, Symbol(p,u))))
            Core.eval(DefaultSymbols, Expr(:export, Symbol(p,u)))
        end
    end

    Core.eval(DefaultSymbols, Expr(:import, Expr(:(.), :Unitful, :ยฐC)))
    Core.eval(DefaultSymbols, Expr(:export, :ยฐC))

    Core.eval(DefaultSymbols, Expr(:import, Expr(:(.), :Unitful, :ยฐ)))
    Core.eval(DefaultSymbols, Expr(:export, :ยฐ))
end

Interested in leading the development of this feature?

  • ๐Ÿš€ Yes! I can lead the development of this feature.

๐Ÿš€ Feature Request: Dispersion relation for `Periodic` equivalence.

Feature Request

The temporal and spatial properties can be related by a dispersion relation. This relation is different for different types of waves, and so cannot be hardcoded. We could provide a way for users to provide a dispersion relation and we return the expanded equivalence class.

Interested in leading the development of this feature?

  • ๐Ÿš€ Yes! I can lead the development of this feature.

๐Ÿ› Bug Report: Pre-compilation error.

Describe the bug

The module is not able to be precompiled, with a long error message.

To Reproduce

julia> using DimensionfulAngles

Expected behavior

Pre-compilations

System

  • OS: PoP!
  • Julia version: 1.9
  • Package version: 0.2
  • Other packages version: [e.g. Unitful.jl 1.12.2, DifferentialEquations.jl 7.6.0, ...]

Additional context

julia> using DimensionfulAngles

[ Info: Precompiling DimensionfulAngles [2d4b8d7a-02d9-40f9-9abe-9c695b77de0d]
WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)),)}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)),)}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)),)}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=1, den=1)),)}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=1, den=1)),)}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=1, den=1)),)}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=1, den=1)), Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)))}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=1, den=1)), Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)))}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=1, den=1)), Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)))}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=-1, den=1)), Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=1, den=1)))}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=-1, den=1)), Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=1, den=1)))}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=-1, den=1)), Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=1, den=1)))}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=-1, den=1)),)}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=-1, den=1)),)}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=-1, den=1)),)}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=1, den=1)),)}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=1, den=1)),)}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=1, den=1)),)}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=1, den=1)), Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=-1, den=1)))}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=1, den=1)), Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=-1, den=1)))}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=1, den=1)), Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=-1, den=1)))}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=-1, den=1)), Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=1, den=1)))}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=-1, den=1)), Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=1, den=1)))}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Angle}(power=Base.Rational{Int64}(num=-1, den=1)), Unitful.Dimension{:Length}(power=Base.Rational{Int64}(num=1, den=1)))}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /home/carlos/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
  ** incremental compilation may be fatally broken for this module **

๐Ÿš€ Feature Request: Conversion to/from Unitful.jl angles.

Feature Request

A way to easily convert between dimensionful angles and dimensionless angles from Unitful.jl and UnitfulAngles.jl.
This should cover quantities with mixed units that include (powers and mixed) angles and should return the same quantity if there are no angles.

Interested in leading the development of this feature?

  • ๐Ÿคช Hmmm.... maybe? Let's talk.
    Need to first come up with an idea on how to tackle it.

๐Ÿงช Testing: Test the `Base` functions using matrixes

Some of the functions in Base can take matrices as input. The code includes the ability to evaluate those functions for matrices of angle quantities, but this functionality is not yet tested. Note that some of the matrix arguments have restrictions (e.g. square matrix, hermitian). Additionally, the SciML style guide recommends testing the following types:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.