Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix README.md so copy and paste works in the REPL #121

Merged
merged 3 commits into from
Sep 20, 2017
Merged

Fix README.md so copy and paste works in the REPL #121

merged 3 commits into from
Sep 20, 2017

Conversation

richardreeve
Copy link
Contributor

I was just running through the online examples, and they weren't working because Julia default REPL pasting behaviour was ignoring several lines of code because they didn't start with 'julia>'. Now fixed.

@iamed2
Copy link
Collaborator

iamed2 commented Sep 18, 2017

Ah yeah those were written before that nice REPL behaviour existed. Thanks for contributing!

If you would like to be an even bigger help you could also address the same and similar case(s) in https://github.com/JuliaArrays/AxisArrays.jl/blob/master/docs/src/index.md

@richardreeve
Copy link
Contributor Author

Sure. No problem - it just seems to be the same lines actually, because the pasting issue only crops up when there is any use of julia> in the text, and there is none in the other blocks. Of course I can still change all of them if you like?

@richardreeve
Copy link
Contributor Author

By the way, the online docs at http://juliaarrays.github.io/AxisArrays.jl/latest/ don't seem to be pulling through updates from the AxisArrays repository now I look at them. The .travis.yml and make.jl scripts looks fine, so I wonder whether Travis doesn't have permission to update the gh-pages branch?

@iamed2
Copy link
Collaborator

iamed2 commented Sep 18, 2017

It looks like it may be because the doctests are failing. I hope it's just because of MersenneTwister implementation changes and not bugs.

@richardreeve
Copy link
Contributor Author

Okay, the doctests did have some small problems. I've fixed them now (on my machine at least!).

@iamed2
Copy link
Collaborator

iamed2 commented Sep 20, 2017

That works and Travis likes it. Thanks!

@iamed2 iamed2 merged commit 2815ef9 into JuliaArrays:master Sep 20, 2017
@iamed2
Copy link
Collaborator

iamed2 commented Sep 20, 2017

If people want to look into why atindex indexing has changed, I think that can be a separate issue.

@mbauman
Copy link
Member

mbauman commented Sep 20, 2017

This is very strange; I cannot reproduce the change in behavior:

julia> begin
       using AxisArrays, Unitful
       import Unitful: s, ms, µs
       rng = MersenneTwister(123)
       fs = 40000
       y = randn(rng, 60*fs+1)*3
       for spk = (sin.(0.8:0.2:8.6) .* [0:0.01:.1; .15:.1:.95; 1:-.05:.05] .* 50,
                  sin.(0.8:0.4:8.6) .* [0:0.02:.1; .15:.1:1; 1:-.2:.1] .* 50)
           i = rand(rng, round(Int,.001fs):1fs)
           while i+length(spk)-1 < length(y)
               y[i:i+length(spk)-1] += spk
               i += rand(rng, round(Int,.001fs):1fs)
           end
       end
       A = AxisArray([y 2y], Axis{:time}(0s:1s/fs:60s), Axis{:chan}([:c1, :c2]))
       end;

julia> A[atindex(-90µs .. 90µs, 5), :c2]
1-dimensional AxisArray{Float64,1,...} with axes:
    :time_sub, -7.5e-5 s:2.5e-5 s:7.5e-5 s
And data, a 7-element Array{Float64,1}:
 12.2891
  6.85591
  2.75649
 -2.38007
 -3.98828
  5.88581
 -0.452898

julia> A[atindex(-10µs .. 10µs, 5), :c2] # ±10µs about index 5 is just index 5
1-dimensional AxisArray{Float64,1,...} with axes:
    :time_sub, 0.0 s:2.5e-5 s:0.0 s
And data, a 1-element Array{Float64,1}:
 -2.38007

julia> A[5, :c2]
-2.380074475771338

This is the correct behavior; the change in documentation is incorrect. What am I doing wrong here? What is Travis doing differently?

@mbauman
Copy link
Member

mbauman commented Sep 20, 2017

Ooooh, I understand now; I was simply looking at the README.md file (and thinking it had been changed).

Thanks so much for the fix, @richardreeve — the documentation had been displaying the older, bugged behavior. I believe this was fixed in #102.

@richardreeve richardreeve deleted the docfix branch September 20, 2017 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants