[julia-users] Re: Does a wrapper for gmtime exist
Thanks both for the suggestions. On Wednesday, 27 July 2016 19:54:38 UTC+1, Jeffrey Sarnoff wrote: > > Andy, > > You are welcome to use https://github.com/J-Sarnoff/UTime.jl > > Pkg.clone("https://github.com/J-Sarnoff/UTime.jl;) > using UTime > > localtime() > 2016-07-27T14:41:37.497-04:00 > > ut() > 2016-07-27T18:41:42Z > > gmt() # gmt aliases ut > 2016-07-27T18:41:45Z > > alocaltime = localtime() > 2016-07-27T14:42:04.282-04:00 > ut(alocaltime) > 2016-07-27T18:42:04.282Z > > auniversaltime = ut() > 2016-07-27T18:42:24Z > localtime(auniversaltime) > 2016-07-27T14:42:24-04:00 > > julia> g=gmt(); g > 2016-07-27T18:50:48Z > > julia> year(g),month(g),day(g),hour(g),minute(g),second(g) > (2016,7,27,18,50,48) > > > > There is more that one may do using UTime, take a look at the README > examples. > > > It has been some time since I revisited it, so please ask if you have any > questions, > and let me know if there is something that is not now working as it had. > I just ran the examples above in v0.5-. > > Regards, > Jeffrey > > On Wednesday, July 27, 2016 at 9:32:56 AM UTC-4, Andrew Gibb wrote: >> >> Hi, >> >> I'm writing a module for dealing with video timing. The C++ code I'm >> using as a basis uses gmtime to convert seconds into y:m:d.etc. Does anyone >> know if this functionality is exposed in Julia anywhere? >> >> I realise I could handle this myself with ccall, I just wanted to check >> to see if I could avoid duplicating effort. >> >> Thanks >> >> Andy >> >
[julia-users] Does a wrapper for gmtime exist
Hi, I'm writing a module for dealing with video timing. The C++ code I'm using as a basis uses gmtime to convert seconds into y:m:d.etc. Does anyone know if this functionality is exposed in Julia anywhere? I realise I could handle this myself with ccall, I just wanted to check to see if I could avoid duplicating effort. Thanks Andy
Re: [julia-users] Julia text editor on iPad?
Is there a way to do shift-enter to execute a cell using the iPad software keyboard? Does shift enter just work on the hardware keyboard?
Re: [julia-users] Forming run() calls programatically
Those methods both work, and help me understand metaprogramming a little. Thanks to you both.
[julia-users] Forming run() calls programatically
I'm trying to use metaprogramming to create two functions. Each of which includes a similar, long, call to run(). The calls are not quite identical. Some flags have different arguments, and some are only present on one call. I can't work out how to get expression interpolation to happen within command interpolation. For example: for (fn, arg) = ((:toucha, "a"), (:touchb, "b")) #@eval ($fn)() = run(`touch $arg`) @eval ($fn)() = run(`touch $(@eval ($arg))`) end In the first of these cases, the result for toucha is toucha() = run(`touch $arg`) and similarly for the second result, the parsing character $ is ignored by the eval. Is there a way to get this to instead return toucha() = run(`touch a`) ?
Re: [julia-users] Re: Rounding to zero from positive or negative numbers results in positive or negative zero.
On Wednesday, 20 April 2016 15:18:06 UTC+1, Stefan Karpinski wrote: > > IEEE has not made the programming language designer's life easy here. > Perhaps it's a subtle attempt to incentivise more designers of mathematical programming languages into IEEE standards committees?! > > On Wed, Apr 20, 2016 at 5:51 AM, Milan Bouchet-Valat> wrote: > >> Le mardi 19 avril 2016 à 22:10 -0700, Jeffrey Sarnoff a écrit : >> > Hi, >> > >> > You have discovered that IEEE standard floating point numbers have >> > two distinct zeros: 0.0 and -0.0. They compare `==` even though they >> > are not `===`. If you want to consider +0.0 and -0.0 to be the same, >> > use `==` or `!=` not `===` or `!==` when testing floating point >> > values (the other comparisons <=, <, >=, > treat the two zeros as a >> > single value). >> There's actually an open issue about what to do with -0.0 and NaN in >> Dicts: https://github.com/JuliaLang/julia/issues/9381 >> >> It turns out it's very hard to find a good solution. >> >> >> Regards >> >> > > Hello everyone! >> > > I was wondering if the following behavior of round() has an special >> > > purpouse: >> > > >> > > a = round(0.1) >> > > 0.0 >> > > >> > > b = round(-0.1) >> > > -0.0 >> > > >> > > a == b >> > > true >> > > >> > > a === b >> > > false >> > > >> > > bits(a) >> > > "" >> > > >> > > >> > > bits(b) >> > > "1000" >> > > >> > > So the sign stays around... >> > > >> > > I am using this rounded numbers as keys in a dictionary and julia >> > > can tell the difference. >> > > >> > > For example, I expected something like this: >> > > dict = [i => exp(i) for i in [a,b]] >> > > Dict{Any,Any} with 1 entry: >> > > 0.0 => 1.0 >> > > >> > > but got this: >> > > dict = [i => exp(i) for i in [a,b]] >> > > Dict{Any,Any} with 2 entries: >> > > 0.0 => 1.0 >> > > -0.0 => 1.0 >> > > >> > > It is not a big problem really but I would like to know where can >> > > this behaviour come handy. >> > > >> > > Cheers! >> > > >> > >
Re: [julia-users] 'do' notation in documentation?
I have a little document which I add to periodically called "Julia unsearchables" where I note down which things can't be found in the docs without asking someone. I do hope, once my Thesis is done, that I can contribute it to the documentation.
[julia-users] Reusing memory with FileIO
Hi, I'm doing work reading image sequences using Images.jl. I haven't been able to find in the docs for Images or FileIO a reference for how to load an image into pre-allocated memory. Does such a thing exist? Thanks Andy
[julia-users] Re: ANN: new blog post on array indexing, iteration, and multidimensional algorithms
Agreed! A very clear introduction which shows off some of the power of these new Array iterators. Thanks, Tim. Andy On Monday, 1 February 2016 18:55:06 UTC, Tim Holy wrote: > > It's come to my attention that some of the exciting capabilities of julia > 0.4 > for indexing, iteration, and writing generic multidimensional algorithms > may > be under-documented. This new blog post > > http://julialang.org/blog/2016/02/iteration/ > > aims to provide a "gentle tutorial" illustrating how to use these > capabilities. > > Best, > --Tim > >
[julia-users] BinDeps Sources, when a URL doesn't have an appropriate extension
Hi, I'm trying to wrap a C library I've written. I want to use BinDeps to build some source. The source is on our internal gitorious git server. A .tar.gz of the code is available, but the URL to get that from just ends in the branch name. So in my code I have provides( Sources, > URI("https://git0.rd.bbc.co.uk/misc/simpleexr/archive-tarball/master;) , > simpleexr) > and later GetSources(simpleexr) Which throws an error: > LoadError: I don't know how to unpack > /home/andrewg/.julia/v0.4/EXRImages/deps/downloads/master > Is there a way to insert an intermediate step to change the name of the downloaded file from master to something.tar.gz? (Or indeed is there a way to use the filename of the file which is returned from the server, which does have the correct extension? As I think about, this seems a bit like a bug.) I guess a bit more code context will be useful: provides( Sources, >> URI("https://git0.rd.bbc.co.uk/misc/simpleexr/archive-tarball/master;) , >> simpleexr) > > >> prefix = joinpath(BinDeps.depsdir(simpleexr),"usr") > > dldir = joinpath(BinDeps.depsdir(simpleexr),"downloads") > > provides(SimpleBuild, > > (@build_steps begin > > GetSources(simpleexr) > > @build_steps begin > > FileRule(joinpath(prefix,"lib","libsimpleexr.so"), >> @build_steps begin > > `./build.sh` > > `cp libsimpleexr.so $prefix/lib` > > `cp libsimpleexr.so.1 $prefix/lib` > > `cp libsimpleexr.so.1.0 $prefix/lib` > > `cp libsimpleexr.h $prefix/include` > > end) > > end > > end > > ) > > , simpleexr, os = :Linux) > > I guess if Tim Holy sees this he'll suggest I use Images/ImageMagick to read an exr image. If there's a way to access the pixel values stored in the image before the gamma correction is applied I would gladly use it. The last time I looked into it, I couldn't find any mention of this in ImageMagick, though.
Re: [julia-users] DataFrame type specification
That worked. Thanks.
[julia-users] DataFrame type specification
I have a csv with some data. One of the columns is something I'd always like to be read as a string, although sometimes the value will just be numerals. Is there some way to specify that I want this column to be an AbstractString in readtable? Or perhaps some way to convert that column from (say) integers to strings once loaded? Thanks Andy
[julia-users] Creating custom METADATA
I'm trying to follow the steps in the 0.4 Manual to create a custom METADATA.jl so that I can distribute packages around my organisation. If I clone JuliaLang/METADATA.jl.git into a local folder, then call Pkg.init() on that folder, I get the following: INFO: Initializing package repository /Users/andrewg/.julia/v0.4 INFO: Package directory /Users/andrewg/.julia/v0.4 is already initialized. And no META_BRANCH is created. Can anyone suggest what I'm doing wrong? Thanks Andy
[julia-users] Updating a single output line in IJulia
Hi, I have some loops I'd like to observe/debug by seeing the parameters change. In the REPL I can do print(" $p1 $p2 \r") flush(STDOUT) and have my parameters updating on a line. This doesn't seem to work in IJulia. When I try it, there is no output. I guess this is because this isn't STDOUT, or something like that. Does anyone know of a nice way to do this? Thanks Andy
[julia-users] Getting started with documentation using Docile and Lexicon in 0.3.x
Hi, Please help me get started with this. Here' a simple Julia module, with an attempt at documention: module DocThis using Docile @docstrings export AThing, addfive @doc This type defines a thing, which is a thing. Here's some code, declared by indenting: ay = AThing(5) bee = AThing(3.14) So that's that. - type AThing bee end @doc Adds five. Just like that. - function addfive(x::Number) return x + 5. end end #module To using this at the REPL, I do using Docile, Lexicon include(docthis.jl) using DocThis which I imagine should be all the initialisation I need to do. But when I do ? AThing I just get DataType : AThing (constructor with 1 method) supertype: Any fields : (:bee,) I have tried various permutations of the documentation syntax: No macros (or arrows), Only @doc macros with arrows, or the version you see above. All of these produce the same results. What am I doing wrong? Thanks Adny
[julia-users] Re: Getting started with documentation using Docile and Lexicon in 0.3.x
Done.[1] It turns out it was because there was no newline after the module end statement. The issue I've opened reflects this. [1 ]https://github.com/MichaelHatherly/Docile.jl/issues/137 On Friday, 5 June 2015 16:04:57 UTC+1, Michael Hatherly wrote: Ok, could you open an issue here [1] and I'll have a closer look at what's going wrong. [1] https://github.com/MichaelHatherly/Docile.jl/issues -- Mike On Friday, 5 June 2015 17:00:49 UTC+2, Andrew Gibb wrote: Mike, Thanks for your answer. I'm afraid your suggestions don't work. I've tried modifying the LOAD_PATH in juliarc.jl, and tried the various permutations of macro usage again. In every case, only the default 0.3.x documentation appears when I do ?-query at the REPL. From the output beneath Docile: updating package list ... It is clear that DocThis is not detected by Docile at all. Perhaps there's something else in the Official Package generation process upon which Docile relies? Andy On Friday, 5 June 2015 15:42:19 UTC+1, Michael Hatherly wrote: Docile works on whole packages rather than individual files. You just need to put the file docthis.jl in the correct load path [1] so that ``using DocThis`` works or else do ``require(docthis.jl)`` rather than ``include(docthis.jl)``. I'll add a mention of this to the documentation shortly. [1] http://docs.julialang.org/en/latest/manual/modules/#module-file-paths -- Mike On Friday, 5 June 2015 16:25:39 UTC+2, Andrew Gibb wrote: Hi, Please help me get started with this. Here' a simple Julia module, with an attempt at documention: module DocThis using Docile @docstrings export AThing, addfive @doc This type defines a thing, which is a thing. Here's some code, declared by indenting: ay = AThing(5) bee = AThing(3.14) So that's that. - type AThing bee end @doc Adds five. Just like that. - function addfive(x::Number) return x + 5. end end #module To using this at the REPL, I do using Docile, Lexicon include(docthis.jl) using DocThis which I imagine should be all the initialisation I need to do. But when I do ? AThing I just get DataType : AThing (constructor with 1 method) supertype: Any fields : (:bee,) I have tried various permutations of the documentation syntax: No macros (or arrows), Only @doc macros with arrows, or the version you see above. All of these produce the same results. What am I doing wrong? Thanks Adny
[julia-users] Re: Getting started with documentation using Docile and Lexicon in 0.3.x
Mike, Thanks for your answer. I'm afraid your suggestions don't work. I've tried modifying the LOAD_PATH in juliarc.jl, and tried the various permutations of macro usage again. In every case, only the default 0.3.x documentation appears when I do ?-query at the REPL. From the output beneath Docile: updating package list ... It is clear that DocThis is not detected by Docile at all. Perhaps there's something else in the Official Package generation process upon which Docile relies? Andy On Friday, 5 June 2015 15:42:19 UTC+1, Michael Hatherly wrote: Docile works on whole packages rather than individual files. You just need to put the file docthis.jl in the correct load path [1] so that ``using DocThis`` works or else do ``require(docthis.jl)`` rather than ``include(docthis.jl)``. I'll add a mention of this to the documentation shortly. [1] http://docs.julialang.org/en/latest/manual/modules/#module-file-paths -- Mike On Friday, 5 June 2015 16:25:39 UTC+2, Andrew Gibb wrote: Hi, Please help me get started with this. Here' a simple Julia module, with an attempt at documention: module DocThis using Docile @docstrings export AThing, addfive @doc This type defines a thing, which is a thing. Here's some code, declared by indenting: ay = AThing(5) bee = AThing(3.14) So that's that. - type AThing bee end @doc Adds five. Just like that. - function addfive(x::Number) return x + 5. end end #module To using this at the REPL, I do using Docile, Lexicon include(docthis.jl) using DocThis which I imagine should be all the initialisation I need to do. But when I do ? AThing I just get DataType : AThing (constructor with 1 method) supertype: Any fields : (:bee,) I have tried various permutations of the documentation syntax: No macros (or arrows), Only @doc macros with arrows, or the version you see above. All of these produce the same results. What am I doing wrong? Thanks Adny
[julia-users] Inferring constructor parameters from parameters of arguments
I want to create a parametric type whose parameter is inferred from the parameter of an argument. A toy example: using Images type TLPixel{T} data::T function TLPixel(img::Image{T}) new(img.data[1,1]) end end If I do this: julia tlp = TLPixel{typeof(img.data[1,1])}(img) This works fine. However, I would have expected the dispatcher(?) to realise that the parameter on the image, T, is the same as the one in the type declaration. But it doesn't: julia tlp = TLPixel(img) `TLPixel{T}` has no method matching TLPixel{T}(::Image{RGB{UfixedBase{Uint8, 8}},2,Array{RGB{UfixedBase{Uint8,8}},2}}) while loading In[4], in expression starting on line 1 Have I done something wrong here, or should I not expect this to work?
[julia-users] Type parameter describes number of items
Is there a way to create a parameterised type where the parameter describes the number of items, ie type Thing{N:Integer} for i = 1:N a_i::Float64 end end I realise one could achieve this simple example with an array, but I'm trying to create a type which holds scale space. My current thinking is this would consist of a parameterisable number of images each with a parameterisable number of layers. And each image in the sequence has the two spatial dimensions (not the number of layers) reduced by a factor of two. I guess you cold do some tricks with array packing, but I guess I'm looking for something more elegant. Is there any way to use the type parameter to indicate a number of elements in this way? Andy
[julia-users] New Images.jl - struggling
I'm having difficulty getting to grips with the new image representations in the reworked Images.jl. I think I've got some of the basics down. But now I'm trying to visualise a spectrum, and I'm stumped. What's the correct way to create an array/image of Float64s from an array/image of Gray{Ufixed8} (So that fft() works), and vice versa (so I can visualize the spectrum)? Thanks.
[julia-users] Problem loading Images module
Hi, I get the following error: julia using Images ERROR: syntax: invalid assignment location in include at ./boot.jl:245 in include_from_node1 at ./loading.jl:128 in include at ./boot.jl:245 in include_from_node1 at ./loading.jl:128 in reload_path at loading.jl:152 in _require at loading.jl:67 in require at loading.jl:51 while loading /Users/andrewg/.julia/v0.3/Images/src/ioformats/OSXnative.jl, in expression starting on line 8 while loading /Users/andrewg/.julia/v0.3/Images/src/Images.jl, in expression starting on line 39 having just done $ make cleanall $ make -j 4 USE_SYSTEM_BLAS=1 I got the same results without the USE_SYSTEM_BLAS flag. I've tried the advice from the Images module readme to comment out a line from Images/src/io.jl, which appears to have no effect on this error. The OS, my julia source (master branch) and homebrew imagemagick etc are all up to date. Is there something I can do to remedy this, or shall I file an issue? I also noticed that the error message I've copied above only appears on the first invocation of using Images at the REPL. further invocations fail silently. Is this intended behaviour? Thanks Andy
[julia-users] Re: Problem loading Images module
I see. Yes, that fixed it. But I learned quite a bit about github and julia in the meantime. :) I've noted the fix in the github issue. On Wednesday, 23 July 2014 12:32:29 UTC+1, ron.s...@gmail.com wrote: Yes, that's my fault, I should have run the tests one last time. I fixed it and tagged a new version (0.2.47) a few ours ago, hoping no one would notice. A `Pkg.update()` should fix it for you.
[julia-users] Implementation of Moment Invariants?
I'm hoping to play around with Geometric Moment Invariants, as (greyscale) image feature descriptors. I get the impression that these might be part of some stats package, but I'm coming at this from the machine vision side, and so don't really know where to look. A few simple google searches don't turn up anything that looks like what I'm looking for. Has anyone made an implementation in Julia yet? Thanks Andy
[julia-users] Re: GSOC 3D Visualizations plotting API - Make a wish!
I'm believe I'm working in a relatively niche area, but I'm going to throw my request in anyway :) I often work with image sequences (from a still or video camera, but nothing more exotic than broadcast cameras) which are to be displayed at video rate (25/50/...Hz), somewhere on a texture in 3D space, after having had some analysis applied to them. Having the ability to apply video textures which were the output of some julia analysis onto a 3D object whose vertices were also the output of some analysis would be really cool. Andy
[julia-users] Broken link in the docs
Apologies if this is the wrong place to post this. The link on this page: http://docs.julialang.org/en/release-0.1/manual/getting-started/ With the text Tutorial for Homer Reid’s numerical analysis class is broken. At a guess, it should point here: http://homerreid.dyndns.org/teaching/18.330/JuliaProgramming.shtml Andy
[julia-users] Re: Broken link in the docs
Thanks for pointing that out Ivar. I'm not sure how I managed to get to the 0.1 docs. I didn't have the tab open *that* long. Currently, http://docs.julialang.org points to http://docs.julialang.org/en/release-0.2/ which seems sensible, as it's the current release. I see the link is indeed fixed in the latest docs. I guess since the release of 0.3 is fairly imminent, a fix to the website will be coming. Andy On Thursday, 1 May 2014 10:15:40 UTC+1, Ivar Nesje wrote: julia-users is a perfect place to start, if you don't know where to report any kind of Julia issue. For simple errors in the documentation, the appropriate fix is to submit a Pull Request on github that changes the appropriate files in the doc/ directory. This particular issue has been fixed in the latest documentationhttp://docs.julialang.org/en/latest/manual/getting-started/#resources. I don't know how to update the older docs, but it might work to submit a pull request against the 0.1-release branch. 0.1 has been obsolete half a year, so I don't think this is a high priority. Unfortunately links and search often points to the old versions, so we should probably consider adding a banner on top of every page to make people aware that they are using the docs for a very old Julia version. Ivar kl. 09:51:36 UTC+2 torsdag 1. mai 2014 skrev Andrew Gibb følgende: Apologies if this is the wrong place to post this. The link on this page: http://docs.julialang.org/en/release-0.1/manual/getting-started/ With the text Tutorial for Homer Reid’s numerical analysis class is broken. At a guess, it should point here: http://homerreid.dyndns.org/teaching/18.330/JuliaProgramming.shtml Andy