MacroTools provides a library of tools for working with Julia code and expressions.

Overview

MacroTools.jl

Build Status

MacroTools provides a library of tools for working with Julia code and expressions. This includes a powerful template-matching system and code-walking tools that let you do deep transformations of code in a few lines. See the docs for more info.

Suggestions, issues and pull requsts are welcome.

Installation

]add MacroTools
Comments
  • Fixes 165, Fixes 177.

    Fixes 165, Fixes 177.

    A partial rewrite of splitarg and combinearg to fix https://github.com/FluxML/MacroTools.jl/issues/165 and https://github.com/FluxML/MacroTools.jl/issues/177.

    The big change here is that arg_type can be nothing if no type is declared for an argument. I know that this is a change to the interface, but I also see no other way to fix the problem. While we are changing the interface, we may want to consider handling literal nothing as an argument default through the base Some and something interface. (discussed in https://github.com/FluxML/MacroTools.jl/issues/35).

    opened by willow-ahrens 23
  • Option to deterministically generate unique ids instead of randomized animal names

    Option to deterministically generate unique ids instead of randomized animal names

    There are a couple of problems with the current animal name scheme used in alias_gensyms:

    1. There are only about 220 animal names in animals.txt. If you have more than 220 gensyms the following line in the current alias_gensyms function is going to error out:

    Base.@get!(syms, x, pop!(left))

    (left is a copy of the animals symbol list)

    1. Currently, the animal names list is randomized when the package is initialized. While working on ONNX.jl we were finding that given the same inputs we would get different code generated due to this randomization. This makes it very difficult for us to debug as we made changes to ONNX.jl and wanted to compare code generated from a prior version on the same inputs.

    This patch generates a simple unique id in the form of "sym_id_$counter" where the counter value is incremented on each gensym encountered.

    I would have preferred replacing all of the "#" characters in the gensym with blanks, however that did not work for me even though I tried the same scheme in the REPL on a gensym string and it did work (see the comment I added in alias_gensyms - maybe someone could get that working?)

    opened by philtomson 13
  • Support function return types in longdef/shortdef

    Support function return types in longdef/shortdef

    I also have a function that uses MacroTools to parse any function definition and return (name, arg, kwargs, body, return_type). Would that be accepted?

    opened by cstjean 13
  • more faithfully reconstruct original function in combinedef

    more faithfully reconstruct original function in combinedef

    Previously combinedef would put an ::Any return type annotation on any function it reconstructed that didn't have one originally, and also wrap the function body in one extra begin block. These both seem completely superfluous except amazingly when combined they trigger the bug I reported here: https://github.com/JuliaLang/julia/issues/29326.

    This PR gets rid of those things and more faithfully reconstructs the original function.

    I also switched to returning the expression via @q which would allow whatever macro is calling combinedef to insert the desired line numbers in there.

    opened by marius311 9
  • move shuffling of animals to be done on demand instead of during initialization

    move shuffling of animals to be done on demand instead of during initialization

    This package is heavily used throughout the ecosystem so optimizing its load time is quite important. The compilation time of the shuffle! call in the __init__ function adds quite a bit of overhead, so I moved this to be done the first time the variable is actually used instead.

    Without this PR:

    julia> @time using MacroTools
      0.067275 seconds (142.56 k allocations: 9.640 MiB, 61.33% compilation time)
    

    With this PR:

    julia> @time using MacroTools
      0.024947 seconds (28.79 k allocations: 3.159 MiB, 22.04% compilation time)
    

    It also removed quite a bit of "noise" when profiling other packages load time that happens to depend on this pacakge recursively.

    opened by KristofferC 8
  • code quality improvements from JET analysis

    code quality improvements from JET analysis

    I ran JET analysis on this package, and fixed some true positive errors.

    run JET on MacroTools

    julia> using JET
    julia> report_file("src/MacroTools.jl"; analyze_from_definitions = true, annotate_types = true)
    

    Before this PR

    ═════ 11 possible errors found ═════
    ┌ @ src/match/match.jl:27 Base.getproperty(Base.getproperty(MacroTools.Base, :match::Symbol)::typeof(match)(r"^@?(.*?)_+(_str)?$", MacroTools.string(s::Symbol)::String)::Union{Nothing, RegexMatch}, :captures::Symbol)
    │┌ @ Base.jl:33 Base.getfield(x::Nothing, f::Symbol)
    ││ type Nothing has no field captures
    │└──────────────
    ┌ @ src/match/types.jl:20 MacroTools.map(MacroTools.totype, ts::Vector{Symbol})
    │┌ @ abstractarray.jl:2301 Base.collect_similar(A::Vector{Symbol}, Base.Generator(f::typeof(MacroTools.totype), A::Vector{Symbol})::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})
    ││┌ @ array.jl:620 Base._collect(cont::Vector{Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, Base.IteratorEltype(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.EltypeUnknown, Base.IteratorSize(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.HasShape{1})
    │││┌ @ array.jl:710 Base.collect_to_with_first!(Base._similar_for(c::Vector{Symbol}, Base.typeof(v1::Union{Expr, Symbol})::Union{Type{Expr}, Type{Symbol}}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, isz::Base.HasShape{1})::Union{Vector{Expr}, Vector{Symbol}}, v1::Union{Expr, Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, st::Int64)
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Symbol}, v1::Expr, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Symbol}, x::Expr)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Symbol}, x::Expr)
    │││││└────────────────
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Expr}, v1::Symbol, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Expr}, x::Symbol)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Expr}, x::Symbol)
    │││││└────────────────
    ┌ @ src/utils.jl:21 Base.collect(Base.Generator(#11::MacroTools.var"#11#12", MacroTools.map(MacroTools.esc, xs::Tuple)::Any)::Base.Generator{_A, MacroTools.var"#11#12"} where _A)
    │┌ @ array.jl:697 Base.collect_to_with_first!(Base._array_for(Base.typeof(v1::Expr)::Type{Expr}, Base.getproperty(itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, :iter::Symbol)::Any, isz::Any)::Any, v1::Expr, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    ││┌ @ array.jl:721 Base.grow_to!(dest::Any, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    │││┌ @ dict.jl:153 Base.indexed_iterate(Core.getfield(Base.indexed_iterate(y::Tuple{Expr, Any}, 1)::Tuple{Expr, Int64}, 1)::Expr, 1)
    ││││┌ @ tuple.jl:89 Base.iterate(I::Expr)
    │││││ no matching method found for call signature: Base.iterate(I::Expr)
    ││││└───────────────
    ┌ @ src/utils.jl:423 MacroTools.rebuilddef(MacroTools.striplines(dict::Dict)::Dict)
    │ variable MacroTools.rebuilddef is not defined: MacroTools.rebuilddef(MacroTools.striplines(dict::Dict)::Dict)
    └────────────────────
    ┌ @ src/utils.jl:455 Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, default::Any)::Tuple{Bool, Any}...)
    │ no matching method found for call signature: Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, default::Any)::Tuple{Bool, Any}...)
    └────────────────────
    ┌ @ src/utils.jl:457 Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg_expr2::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, MacroTools.nothing)::Tuple{Bool, Nothing}...)
    │ no matching method found for call signature: Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg_expr2::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, MacroTools.nothing)::Tuple{Bool, Nothing}...)
    └────────────────────
    ┌ @ src/structdef.jl:13 MacroTools.parse_error(ex::Any)
    │ variable MacroTools.parse_error is not defined: MacroTools.parse_error(ex::Any)
    └───────────────────────
    ┌ @ src/structdef.jl:21 MacroTools.parse_error(ex::Any)
    │ variable MacroTools.parse_error is not defined: MacroTools.parse_error(ex::Any)
    └───────────────────────
    ┌ @ src/structdef.jl:29 MacroTools.parse_error(ex::Any)
    │ variable MacroTools.parse_error is not defined: MacroTools.parse_error(ex::Any)
    └───────────────────────
    ┌ @ src/examples/destruct.jl:24 MacroTools.error("Can't destructure fields with default values")
    │┌ @ error.jl:33 error(::String)
    ││ may throw: Base.throw($(Expr(:invoke, MethodInstance for ErrorException(::String), :(Base.ErrorException), Core.Argument(2)))::ErrorException)
    │└───────────────
    

    After this PR: only the false positives ramain (Julia's inference or JET itself should be improved)

    ═════ 4 possible errors found ═════
    ┌ @ src/match/types.jl:20 MacroTools.map(MacroTools.totype, ts::Vector{Symbol})
    │┌ @ abstractarray.jl:2301 Base.collect_similar(A::Vector{Symbol}, Base.Generator(f::typeof(MacroTools.totype), A::Vector{Symbol})::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})
    ││┌ @ array.jl:620 Base._collect(cont::Vector{Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, Base.IteratorEltype(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.EltypeUnknown, Base.IteratorSize(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.HasShape{1})
    │││┌ @ array.jl:710 Base.collect_to_with_first!(Base._similar_for(c::Vector{Symbol}, Base.typeof(v1::Union{Expr, Symbol})::Union{Type{Expr}, Type{Symbol}}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, isz::Base.HasShape{1})::Union{Vector{Expr}, Vector{Symbol}}, v1::Union{Expr, Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, st::Int64)
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Symbol}, v1::Expr, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Symbol}, x::Expr)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Symbol}, x::Expr)
    │││││└────────────────
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Expr}, v1::Symbol, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Expr}, x::Symbol)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Expr}, x::Symbol)
    │││││└────────────────
    ┌ @ src/utils.jl:21 Base.collect(Base.Generator(#11::MacroTools.var"#11#12", MacroTools.map(MacroTools.esc, xs::Tuple)::Any)::Base.Generator{_A, MacroTools.var"#11#12"} where _A)
    │┌ @ array.jl:697 Base.collect_to_with_first!(Base._array_for(Base.typeof(v1::Expr)::Type{Expr}, Base.getproperty(itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, :iter::Symbol)::Any, isz::Any)::Any, v1::Expr, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    ││┌ @ array.jl:721 Base.grow_to!(dest::Any, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    │││┌ @ dict.jl:153 Base.indexed_iterate(Core.getfield(Base.indexed_iterate(y::Tuple{Expr, Any}, 1)::Tuple{Expr, Int64}, 1)::Expr, 1)
    ││││┌ @ tuple.jl:89 Base.iterate(I::Expr)
    │││││ no matching method found for call signature: Base.iterate(I::Expr)
    ││││└───────────────
    ┌ @ src/examples/destruct.jl:24 MacroTools.error("Can't destructure fields with default values")
    │┌ @ error.jl:33 error(::String)
    ││ may throw: Base.throw($(Expr(:invoke, MethodInstance for ErrorException(::String), :(Base.ErrorException), Core.Argument(2)))::ErrorException)
    │└───────────────
    
    opened by aviatesk 8
  • improve code quality and type instabilities

    improve code quality and type instabilities

    I used JET and fixed some actual errors and type instabilities. (this PR is the final output of my demo at our workshop)

    /cc @pfitzseb Could you review this PR, please ? :)

    opened by aviatesk 7
  • splitarg incompatible with kwargs on 1.7

    splitarg incompatible with kwargs on 1.7

    Therefore, it is no longer safe to do funcdef[:kwargs] = map(arg->combinearg(splitarg(arg)...), funcdef[:kwargs], since this would transform a definition like f(;kwargs...) to f(;kwargs::Any...) which is no longer allowed in Julia 1.7. I don't know why that's no longer allowed, but from the REPL:

    ERROR: syntax: "x::Any" is not a valid function argument name around REPL[3]:1
    Stacktrace:
     [1] top-level scope
       @ REPL[3]:1
    
    opened by willow-ahrens 6
  • make

    make "slurp" pattern configurable

    This PR setups IGNORED_SLURP_PATTERNS::Set{Symbol}, which allows users to configure patterns that should not be recognized as "slurp"s.

    The motivation here is that there can be double-scores in variable names and so we sometimes may want them not to be recognized as "slurp" pattern.

    For example, let's consider when we want to specify a pattern that only matches __init__() expression:

    julia> @capture(:(__init__()), __init__()), @capture(:(foo()), __init__()) # you may want the latter case not to match
    (true, true)
    

    With this PR, we can configure IGNORED_SLURP_PATTERNS and achieve what we want:

    julia> push!(MacroTools.IGNORED_SLURP_PATTERNS, :__init__); # configure `IGNORED_SLURP_PATTERNS`
    
    julia> @capture(:(__init__()), __init__()), @capture(:(foo()), __init__()) # now `__init__` isn't recognized as slurp pattern
    (true, false)
    

    IGNORED_SLURP_PATTERNS is initialized as an empty set, and thus this change doesn't break any existing behavior by default.

    opened by aviatesk 6
  • don't use exceptions to implement `ismatch` and `trymatch`

    don't use exceptions to implement `ismatch` and `trymatch`

    This is causing https://github.com/JuliaLang/julia/issues/28221. At least for APIs that return a result instead of exposing MatchError, the package should use return values instead of exceptions.

    opened by JeffBezanson 5
  • bizzare match failure for macros in type assertions

    bizzare match failure for macros in type assertions

    MacroTools can't match macros when they appear in the type assertions in function calls. This seems like a crazy issue, but a key macro in my package depended on this functionality and now something has changed with the latest julia build and things fail. Any ideas as to why this match failure would happen?

                   _
       _       _ _(_)_     |  A fresh approach to technical computing
      (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
       _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
      | | | | | | |/ _` |  |
      | | |_| | | | (_| |  |  Version 0.7.0-DEV.5246 (2018-05-29 13:27 UTC)
     _/ |\__'_|_|_|\__'_|  |  Commit 082be9a (8 days old master)
    |__/                   |  x86_64-apple-darwin17.5.0
    
    (v0.7) pkg> up MacroTools
      Updating registry at `~/.julia/registries/Uncurated`
      Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
     Resolving package versions...
      Updating `~/.julia/environments/v0.7/Project.toml`
     [no changes]
      Updating `~/.julia/environments/v0.7/Manifest.toml`
     [no changes]
    
    julia> using MacroTools
    
    julia> x = :(foo(x::@bar(qux))).args[2].args[2]
    :(#= REPL[3]:1 =# @bar qux)
    
    julia> :(@bar(qux))
    :(#= REPL[4]:1 =# @bar qux)
    
    julia> x.head
    :macrocall
    
    julia> :(@bar(qux)).head
    :macrocall
    
    julia> x.args
    3-element Array{Any,1}:
     Symbol("@bar")
     :(#= REPL[3]:1 =#)
     :qux
    
    julia> :(@bar(qux)).args
    3-element Array{Any,1}:
     Symbol("@bar")
     :(#= REPL[8]:1 =#)
     :qux
    
    julia> @capture(x, @bar(qux))
    false
    
    julia> @capture(:(@bar(qux)), @bar(qux))
    true
    

    EDIT: It appears that this has something to do with line number nodes getting passed as arguments to macros. I rolled a custom solution for myself, but I'll dig into this sometime when I have more time. I don't think this has anything to do with the type assertions at all now.

    opened by willow-ahrens 5
  • Splitdef errors on anonymous function with a single varargs argument

    Splitdef errors on anonymous function with a single varargs argument

    splitdef fails with an assertion on an anonymous function with a single varargs argument:

    julia> splitdef(Meta.parse(" (args...) -> 0 "))
    ERROR: ArgumentError: Not a function definition: :(args...->begin
              #= none:1 =#
              0
          end)
    Stacktrace:
     [1] splitdef(fdef::Expr)
       @ MacroTools ~/.julia/packages/MacroTools/PP9IQ/src/utils.jl:317
    

    Either adding another argument or using the long form of the definition is fine:

    julia> splitdef(Meta.parse(" (x, args...) -> 0 "))
    Dict{Symbol, Any} with 4 entries:
      :args        => Any[:x, :(args...)]
      :body        => quote…
      :kwargs      => Any[]
      :whereparams => ()
    
    julia> splitdef(Meta.parse(" function f(args...) 0 end "))
    Dict{Symbol, Any} with 5 entries:
      :name        => :f
      :args        => Any[:(args...)]
      :kwargs      => Any[]
      :body        => quote…
      :whereparams => ()
    
    opened by julbinb 1
  • @capture union problem

    @capture union problem

    Similar to what was noted in https://github.com/FluxML/MacroTools.jl/issues/40#issuecomment-357466077,

    julia> @capture :(myvariable = 2) (lhs_Symbol = rhs_)
    true
    
    julia> @capture :(myvariable = 2) (lhs_Symbol = rhs_) | someotherpat
    false
    
    julia> @capture :(myvariable = 2) (lhs_ = rhs_) | someotherpat
    true
    

    The second match should be true as well.

    opened by cstjean 0
  • add dict interface splitargdef and combineargdef

    add dict interface splitargdef and combineargdef

    This PR adds new methods splitargdef and combineargdef (in addition to existing splitarg and combinearg) that use dictionaries as an interface. The dict interface more completely expresses corner cases, as described in https://github.com/FluxML/MacroTools.jl/pull/178. In particular, it provides robust solutions for literal nothing argument defaults and avoids typeasserts when no type is given for an argument.

    opened by willow-ahrens 5
  • `isdef()` seems to return true in any case

    `isdef()` seems to return true in any case

    help?> MacroTools.isdef
      Test for function definition expressions.
    
    julia> MacroTools.isdef(:(f() = 3))
    true
    
    julia> MacroTools.isdef(:(f()))
    true
    
    julia> MacroTools.isdef(:ix)
    true
    
    
    opened by omlins 2
  • rmlines would be more useful if it worked recursively

    rmlines would be more useful if it worked recursively

    rmlines would be more useful it it worked recursively.

    rmlines(Meta.parse("""
    begin
       begin
          begin
    end
    end
    end"""))
    quote
        begin
            #= none:3 =#
            begin
                #= none:4 =#
            end
        end
    end
    

    Yes, one could use postwalk, but I don't think one should have to.

    Also, why isn't postwalk exported?

    At the very least, the documentation should manage expectations by saying that it doesn'[t work recursively and suggesting the use of postwalk.

    opened by MarkNahabedian 1
Releases(v0.5.10)
Owner
FluxML
The Elegant Machine Learning Stack
FluxML
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It can use GPUs and perform efficient symbolic differentiation.

============================================================================================================ `MILA will stop developing Theano <https:

null 9.6k Jan 6, 2023
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It can use GPUs and perform efficient symbolic differentiation.

============================================================================================================ `MILA will stop developing Theano <https:

null 9.3k Feb 12, 2021
✔️ Visual, reactive testing library for Julia. Time machine included.

PlutoTest.jl (alpha release) Visual, reactive testing library for Julia A macro @test that you can use to verify your code's correctness. But instead

Pluto 68 Dec 20, 2022
Turning SymPy expressions into PyTorch modules.

sympytorch A micro-library as a convenience for turning SymPy expressions into PyTorch Modules. All SymPy floats become trainable parameters. All SymP

Patrick Kidger 89 Dec 13, 2022
Turning SymPy expressions into JAX functions

sympy2jax Turn SymPy expressions into parametrized, differentiable, vectorizable, JAX functions. All SymPy floats become trainable input parameters. S

Miles Cranmer 38 Dec 11, 2022
Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more

Apache MXNet (incubating) for Deep Learning Apache MXNet is a deep learning framework designed for both efficiency and flexibility. It allows you to m

The Apache Software Foundation 20.2k Jan 8, 2023
Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more

Apache MXNet (incubating) for Deep Learning Apache MXNet is a deep learning framework designed for both efficiency and flexibility. It allows you to m

The Apache Software Foundation 20.2k Jan 5, 2023
Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more

Apache MXNet (incubating) for Deep Learning Apache MXNet is a deep learning framework designed for both efficiency and flexibility. It allows you to m

The Apache Software Foundation 19.3k Feb 12, 2021
Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more

Apache MXNet (incubating) for Deep Learning Master Docs License Apache MXNet (incubating) is a deep learning framework designed for both efficiency an

ROCm Software Platform 29 Nov 16, 2022
Numba-accelerated Pythonic implementation of MPDATA with examples in Python, Julia and Matlab

PyMPDATA PyMPDATA is a high-performance Numba-accelerated Pythonic implementation of the MPDATA algorithm of Smolarkiewicz et al. used in geophysical

Atmospheric Cloud Simulation Group @ Jagiellonian University 15 Nov 23, 2022
Python and Julia in harmony.

PythonCall & JuliaCall Bringing Python® and Julia together in seamless harmony: Call Python code from Julia and Julia code from Python via a symmetric

Christopher Rowley 414 Jan 7, 2023
A little software to generate and save Julia or Mandelbrot's Fractals.

Julia-Mandelbrot-s-Fractals A little software to generate and save Julia or Mandelbrot's Fractals. Dependencies : Python 3.7 or more. (Also possible t

Olivier 0 Jul 9, 2022
Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab

PySDM PySDM is a package for simulating the dynamics of population of particles. It is intended to serve as a building block for simulation systems mo

Atmospheric Cloud Simulation Group @ Jagiellonian University 32 Oct 18, 2022
A set of tools for converting a darknet dataset to COCO format working with YOLOX

darknet格式数据→COCO darknet训练数据目录结构(详情参见dataset/darknet): darknet ├── class.names ├── gen_config.data ├── gen_train.txt ├── gen_valid.txt └── images

RapidAI-NG 148 Jan 3, 2023
Perspective: Julia for Biologists

Perspective: Julia for Biologists 1. Examples Speed: Example 1 - Single cell data and network inference Domain: Single cell data Methodology: Network

Elisabeth Roesch 55 Dec 2, 2022
Calling Julia from Python - an experiment on data loading

Calling Julia from Python - an experiment on data loading See the slides. TLDR After reading Patrick's blog post, we decided to try to replace C++ wit

Abel Siqueira 8 Jun 7, 2022
HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events globally on daily to subseasonal timescales.

HeatNet HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events glob

Google Research 6 Jul 7, 2022
pybaum provides tools to work with pytrees which is a concept burrowed from JAX.

pybaum provides tools to work with pytrees which is a concept burrowed from JAX.

Open Source Economics 9 May 11, 2022
Core ML tools contain supporting tools for Core ML model conversion, editing, and validation.

Core ML Tools Use coremltools to convert machine learning models from third-party libraries to the Core ML format. The Python package contains the sup

Apple 3k Jan 8, 2023