Open marobg opened 9 years ago
Regarding femto-seconds: Unless there's a naming conflict somewhere (and I'm not aware of any) I don't see a reason not to expose fs
as another short-hand constant. Submit a pull-request (new to git? Check this out...) with the change, and if there are more things to say about it we could take it in that issue.
Regarding conversions from other unit systems, I personally feel this is out of scope for this package (if we do conversions from the Imperial unit system, what other unit systems should we also support? The number of conversions rapidly explodes into madness...) but I do see lots of possible use-cases, so there's definitely good reason for it to be supported somewhere. In the long run it might be possible to generalize SIUnits.jl with an abstraction over "base units" (i.e. mass, time, length etc) that other unit systems could also build on, but that's quite a big project, and probably not very likely to happen anytime soon. As a short-term solution, maybe it's possible to work on Physical.jl to make it use SIUnits.jl instead of it's own unit system, and/or build a separate package that glues SIUnits.jl together with some representation of other unit systems?
Also: welcome to the Julia community! :smile:
There would be no reason not to start an Imperial.jl package, and have it say using SIUnits
and define conversions between the systems.
There were some discussions in #22 about generalizations of SIUnits; unfortunately I have been occupied by other tasks, so I haven't given thought to, or put effort into, abstracting the "generate new unitful number types" infrastructure. @marobg, that would be a great contribution, although perhaps not the easiest way to get started with Julia :smile:. I'd recommend starting with something simpler: rather than going for the general solution, just support the units you actually use by defining them, and their conversions, manually.
@tlycken,@timholy: thank you for the warm welcome! I will get on with your suggestion about fs
. In my case and for many lasers guys fs
, ps
and ns
are the most commonly used units. I will try to add the shorthand notations I use.
I see the point of not making the SIUnits.jl all inclusive at the moment as it will take an enormous amount of work just for units and then there are constants left as well - and that's a book on its own. SIUnits.jl actually works perfect for me with that small shorthand addition and I can define constants like c
in my code. That's the perspective of a laser guy of course.
@timholy: Abstracting the "generate new unitful number types" infrastructure seems like the way to go. Thank you for pointing that out to me!
Hello,
first off I am very new to Julia (most of my experience is in Matlab and Mathematica). I was hoping to learn a bit about it and have read most of the documentation - SWELL JOB to all contributors! My field of knowledge is ultrafast laser systems and most of the simulations I have done during my PhD were plagued by slow calculation times which I hope Julia will be able to resolve. The way we model the pulses is to center a 2D complex grid with t=0,r=0 at the centroid of the pulse (in case of gaussian shape the peak) and use Fourier/Bessel transforms or differential equations to predict linear and nonlinear effects.
The first step to model this is having the correct units on the grid - I usually use Femtoseconds and Microns or Nanometers. This is why SIUnits.jl is the perfect starting point for me. I downloaded the package (Pkg.add("SIUnits")) and used it. I am really impressed by the no-penalty performance it has.
I couldn't find the "fs" shorthand. Is there a conflict with the Base() system or another reason for that? I was able to add it into my own .jl version of the code and export it and use it, but since I am new I don't know if it's ok for me to collaborate right away and upload it.
I addition to that I was hoping to add my own conversion to "inches" from "centimeters" as most of the micrometers in the lab are usually in Imperial metrics. I know the Physical.jl package has a lot of those already in, but it might be a good thing to merge those, which I will be thrilled to somehow help with. The main reason I prefer SIUnits.jl is that it actually doesn't slow down the calculation times. I need to do anywhere between 2000-5000 FFTs in a normal simulation of mine so every millisecond counts - literally.
Cheers