alanedelman / 18.337_2016

24 stars 15 forks source link

Homework 4 Code Issues #12

Open KyleKotowick opened 7 years ago

KyleKotowick commented 7 years ago

I'm having a couple technical issues with Homework 4, wondering if anyone might have come across them.

1) @manipulate does not play nicely with matshow I cannot seem to make this work to "scroll through the images" as the homework instructs. When changing the manipulate slider, it just doesn't update the matshow image. What I'm trying, but doesn't work:

test = load("/home/ubuntu/.julia/documents/18.337_2016/homeworks/homework_4/test_digits.jld")
digits = test["digits"]
@manipulate for n in 1:size(digits,2)
    data = reshape(digits[:,n],16,16)
    matshow(data');
end

2) colorview is crashing the kernel, every time I try to use it. The following minimal example, which should just show a black square, crashes the kernel:

d = zeros(10,10);
colorview(RGB, d, d, d)
visuddhi commented 7 years ago

I had the same problem with colorview, what I did is to use colorim instead.

See: http://stackoverflow.com/questions/25715909/export-a-uint8-array-as-an-image-using-images-in-julia

KyleKotowick commented 7 years ago

Ah yes, colorim works. Regarding the other issue, does matshow work with @manipulate for you? i.e. does the image update when you move the manipulate slider?

visuddhi commented 7 years ago

The @manipulate just does not work on my setup (I don't have any UI buttons)... So I'm reporting the results separately (without using @manipulate)...

timholy commented 7 years ago

Author of Images here. I don't get the same crash with

using Images
d = zeros(10,10);
colorview(RGB, d, d, d)

(It just shows a black square, like it should.)

Can you please send the result of versioninfo() and Pkg.status()?

kameeko commented 7 years ago

I had the same issue with matshow, so I'm using pcolormesh instead.

colorview also crashes for me for that minimal working example. (Previous posts did not mention Colors or ImageCore, but the minimal example can't find colorview or RGB without them...?)

Pkg.add("Images")
Pkg.add("Colors")
Pkg.add("ImageCore")
Pkg.update()
d = zeros(10,10);
colorview(RGB, d, d, d)
using Images, Colors, ImageCore

versioninfo() gives:

Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)

Pkg.status() gives:

11 required packages:
 - BenchmarkTools                0.0.5
 - Colors                        0.6.9
 - IJulia                        1.3.2
 - ImageCore                     0.0.5
 - ImageMagick                   0.1.8
 - Images                        0.5.14
 - Interact                      0.3.5
 - JLD                           0.6.6
 - PyPlot                        2.2.4
 - StatsBase                     0.11.1
 - TextAnalysis                  0.1.0
33 additional packages:
 - BinDeps                       0.4.5
 - Blosc                         0.1.7
 - ColorTypes                    0.2.12
 - ColorVectorSpace              0.1.11
 - Compat                        0.9.3
 - Conda                         0.4.0
 - DataArrays                    0.3.10
 - DataFrames                    0.8.4
 - DataStructures                0.4.6
 - FileIO                        0.2.0
 - FixedPointNumbers             0.2.1
 - GZip                          0.2.20
 - Graphics                      0.1.3
 - HDF5                          0.7.0
 - JSON                          0.8.0
 - LaTeXStrings                  0.2.0
 - Languages                     0.1.0
 - LegacyStrings                 0.1.1
 - MacroTools                    0.3.2
 - MappedArrays                  0.0.5
 - Nettle                        0.2.4
 - OffsetArrays                  0.2.12
 - PyCall                        1.7.2
 - Reactive                      0.3.6
 - Reexport                      0.0.3
 - SHA                           0.2.1
 - SIUnits                       0.1.0
 - ShowItLikeYouBuildIt          0.0.1
 - SortingAlgorithms             0.1.0
 - TexExtensions                 0.0.3
 - URIParser                     0.1.6
 - ZMQ                           0.4.0
 - Zlib                          0.1.12
timholy commented 7 years ago

Everyone in the class needs to download this gist and then say

include("imagebranch.jl")
imagebranch("fixed-renaming")

More detail at https://github.com/timholy/Images.jl/issues/542#issuecomment-254059092, but this is the bottom line.

timholy commented 7 years ago

Oh, and just to make sure people know where to find docs: http://juliaimages.github.io/latest/

Please report issues to https://github.com/timholy/Images.jl/issues. Preferably each item as a separate issue. I'd view it as good thing if I get 15 bug reports or "this seems unnecessarily cumbersome" reports, as it's very hard as the author of software to know what other people find unintuitive.

musm commented 7 years ago

@timholy I get this trying to run your script

julia> imagebranch("fixed-renaming")
INFO: Checking out FixedPointNumbers teh/compact_printing...
INFO: Pulling FixedPointNumbers latest teh/compact_printing...
INFO: No packages to install, update or remove
INFO: Checking out Images fixed-renaming...
INFO: Pulling Images latest fixed-renaming...
INFO: Cloning cache of AxisArrays from https://github.com/JuliaArrays/AxisArrays.jl.git
INFO: Cloning cache of CatIndices from https://github.com/JuliaArrays/CatIndices.jl.git
INFO: Cloning cache of ComputationalResources from https://github.com/timholy/ComputationalResources.jl.git
INFO: Cloning cache of CustomUnitRanges from https://github.com/JuliaArrays/CustomUnitRanges.jl.git
INFO: Cloning cache of FFTViews from https://github.com/JuliaArrays/FFTViews.jl.git
INFO: Cloning cache of ImageAxes from https://github.com/JuliaImages/ImageAxes.jl.git
INFO: Cloning cache of ImageCore from https://github.com/JuliaImages/ImageCore.jl.git
INFO: Cloning cache of ImageFiltering from https://github.com/JuliaImages/ImageFiltering.jl.git
INFO: Cloning cache of ImageMetadata from https://github.com/JuliaImages/ImageMetadata.jl.git
INFO: Cloning cache of IndirectArrays from https://github.com/JuliaArrays/IndirectArrays.jl.git
INFO: Cloning cache of IntervalSets from https://github.com/JuliaMath/IntervalSets.jl.git
INFO: Cloning cache of MappedArrays from https://github.com/JuliaArrays/MappedArrays.jl.git
INFO: Cloning cache of OffsetArrays from https://github.com/alsam/OffsetArrays.jl.git
INFO: Cloning cache of RangeArrays from https://github.com/JuliaArrays/RangeArrays.jl.git
INFO: Cloning cache of ShowItLikeYouBuildIt from https://github.com/JuliaArrays/ShowItLikeYouBuildIt.jl.git
INFO: Cloning cache of SimpleTraits from https://github.com/mauro3/SimpleTraits.jl.git
INFO: Updating cache of StaticArrays...
INFO: Cloning cache of TiledIteration from https://github.com/JuliaArrays/TiledIteration.jl.git
INFO: Installing AxisArrays v0.0.2
INFO: Installing CatIndices v0.0.1
INFO: Installing ComputationalResources v0.0.1
INFO: Installing CustomUnitRanges v0.0.3
INFO: Installing FFTViews v0.0.1
INFO: Installing ImageAxes v0.0.2
INFO: Installing ImageCore v0.0.5
INFO: Installing ImageFiltering v0.0.2
INFO: Installing ImageMetadata v0.0.1
INFO: Installing IndirectArrays v0.0.1
INFO: Installing IntervalSets v0.0.2
INFO: Installing MappedArrays v0.0.5
INFO: Installing OffsetArrays v0.2.12
INFO: Installing RangeArrays v0.1.1
INFO: Installing ShowItLikeYouBuildIt v0.0.1
INFO: Installing SimpleTraits v0.1.1
INFO: Installing StaticArrays v0.0.11
INFO: Installing TiledIteration v0.0.1
INFO: Checking out ColorTypes fixed-renaming...
ERROR: GitError(Code:ERROR, Class:Merge, There is no tracking information for the current branch.)
 in #123 at .\libgit2\libgit2.jl:414 [inlined]
 in with(::Base.LibGit2.##123#128{Base.LibGit2.GitRepo}, ::Void) at .\libgit2\types.jl:638
 in (::Base.LibGit2.##119#124{String,String,Bool,Base.LibGit2.MergeOptions,Base.LibGit2.CheckoutOptions,Base.LibGit2.GitRepo})(::Base.LibGit2.GitReference) at .\libgit2\libgit2.jl:412
 in with(::Base.LibGit2.##119#124{String,String,Bool,Base.LibGit2.MergeOptions,Base.LibGit2.CheckoutOptions,Base.LibGit2.GitRepo}, ::Base.LibGit2.GitReference) at .\libgit2\types.jl:638
 in (::Base.#kw##merge!)(::Array{Any,1}, ::Base.#merge!, ::Base.LibGit2.GitRepo) at .\<missing>:0
 in (::Base.Pkg.Entry.##18#20{String,String,Bool,Bool})(::Base.LibGit2.GitRepo) at .\pkg\entry.jl:231
 in transact(::Base.Pkg.Entry.##18#20{String,String,Bool,Bool}, ::Base.LibGit2.GitRepo) at .\libgit2\libgit2.jl:520
 in with(::Base.Pkg.Entry.##17#19{String,String,Bool,Bool}, ::Base.LibGit2.GitRepo) at .\libgit2\types.jl:638
 in checkout(::String, ::String, ::Bool, ::Bool) at .\pkg\entry.jl:227
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#checkout,Tuple{String,String,Bool,Bool}})() at .\pkg\dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#checkout,Tuple{String,String,Bool,Bool}}, ::String) at .\file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
 in checkoutbranch(::Array{String,1}, ::String) at .\REPL[5]:3
 in imagebranch(::String) at .\REPL[7]:14
musm commented 7 years ago

@timholy trying your simple example with master ColorTypes fails with

Error encountered while saving "Nullable{String}()".
Fatal error:
UndefVarError: AxisArrays not defined
djsegal commented 7 years ago

Gadfly's spy mimics matshow and works correctly with @manipulate.

see: http://stackoverflow.com/questions/24598690/julia-plot-matrix-with-gadfly-jl

musm commented 7 years ago

thanks ! finally something that works

alanedelman commented 7 years ago

workaround's are great but we should also fix the original problems

timholy commented 7 years ago

@musm, is your ColorTypes dirty? If so do git stash and then try re-running imagebranch.

timholy commented 7 years ago

I have a different guess now: it needed to fetch the latest first. I just updated that gist, see if it works better now.

If that fails, you can also try

cd(Pkg.dir("ColorTypes"))
;git checkout fixed-renaming

where the initial semicolon activates shell mode. If that fails for some reason, let me know the details.

musm commented 7 years ago

@timholy thanks, things look like they are now working !

alanedelman commented 7 years ago

a number of students had issues https://github.com/alanedelman/18.337_2016/issues/12 and workarounds

by the way i think i had the wrong vcat on the svd should have it straight soon

On Thu, Nov 10, 2016 at 2:00 PM, Mus M notifications@github.com wrote:

@timholy https://github.com/timholy thanks, things look like they are now working !

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alanedelman/18.337_2016/issues/12#issuecomment-259776749, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0pQrFtpXNUymQlSdv5Qd5l6LOf4sv_ks5q82nfgaJpZM4KtG_J .