Skip to content

Commit

Permalink
udpate build script
Browse files Browse the repository at this point in the history
Fix List and some tests
  • Loading branch information
jonathanBieler committed Nov 3, 2018
1 parent ee6e3c5 commit dad60e9
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 46 deletions.
25 changes: 17 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
# Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
sudo: true
sudo: required
os:
- linux
julia:
- 0.4
- 0.5
- 0.7
- 1.0
- nightly
matrix:
allow_failures:
- julia: nightly
notifications:
email: false
addons:
apt:
packages:
- xvfb
- xauth
- libgtk-3-0
before_install:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- libgtk-3-dev
- at-spi2-core
script:
- xvfb-run julia -e 'Pkg.clone(pwd()); Pkg.build("Immerse"); Pkg.test("Immerse"; coverage=true)'
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("Immerse")'
- if [ `uname` = "Linux" ]; then
xvfb-run julia --check-bounds=yes -e 'using Pkg; Pkg.test("Immerse", coverage=true)';
elif [ `uname` = "Darwin" ]; then
julia --check-bounds=yes -e 'using Pkg; Pkg.test("Immerse", coverage=true)';
fi
after_success:
- julia -e 'using Pkg; cd(Pkg.dir("Immerse")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())';
5 changes: 3 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
julia 0.7
DataFrames
Gadfly
Compose 0.3.19
Compose
Measures
Colors
Gtk 0.11
Gtk
GtkUtilities
Reexport
34 changes: 17 additions & 17 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
environment:
matrix:
- JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIAVERSION: "julialang/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- julia_version: 0.7
- julia_version: 1.0

platform:
#- x86 # 32-bit
- x64 # 64-bit

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - julia_version: latest

branches:
only:
Expand All @@ -19,18 +25,12 @@ notifications:
on_build_status_changed: false

install:
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$("http://s3.amazonaws.com/"+$env:JULIAVERSION),
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"Immerse\"); Pkg.build(\"Immerse\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Immerse\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
9 changes: 7 additions & 2 deletions src/compose.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# module ImmerseCompose

import Base: start, next, done
#import Base: start, next, done

# import Compose
using Measures: Vec, Measure, AbsoluteBox, resolve
using Compose: Backend
using Compose: Container, Context, Table
using Compose: Form, Line, Circle
using Compose: Property, Stroke, Fill, LineWidth, Visible, SVGClass
using Compose: ListNode
using Compose: List, ListNode, ListNull
using Compose: Transform, IdentityTransform, MatrixTransform, UnitBox
using Compose: absolute_native_units

start(l::List) = l
next(::List, l::List) = (l.head, l.tail)
done(::List, l::List) = typeof(l) <: ListNull
cons(value, l::List{T}) where T = ListNode{T}(value, l)

# using Compat, Colors #, GtkUtilities
# import Gtk

Expand Down
6 changes: 3 additions & 3 deletions src/display_gadfly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# import Gadfly, Compose, Gtk
import Gadfly: Plot, Aesthetics, Coord.Cartesian
import Gtk: GtkCanvas
import Gtk: GtkCanvas, showall
# import ..Immerse
# import ..Immerse: absolute_to_data, find_tagged, setproperty!

Expand Down Expand Up @@ -217,7 +217,7 @@ function dropfig(d::GadflyDisplay, i::Int)
haskey(d.figs,i) || return
delete!(d.figs, i)
splice!(d.fig_order, something(findfirst(isequal(i), d.fig_order), 0) )

d.next_fig = min(d.next_fig, i)
d.current_fig = isempty(d.fig_order) ? 0 : d.fig_order[end]
end
Expand Down Expand Up @@ -434,7 +434,7 @@ function GtkUtilities.panzoom(f::Figure)
aes = _aes(f)
xview = (aes.xviewmin, aes.xviewmax)
yview = (aes.yviewmin, aes.yviewmax)

if xview == (nothing, nothing)
xview = (minimum(aes.x),maximum(aes.x))
end
Expand Down
6 changes: 3 additions & 3 deletions test/faces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ end

function showimg(imgs, indx)
img = imgs[indx]
c = @GtkCanvas()
f = @GtkAspectFrame(c, "", 0.5, 0.5, size(img,1)/size(img,2))
win = @GtkWindow(f, string("Face ", indx))
c = GtkCanvas()
f = GtkAspectFrame(c, "", 0.5, 0.5, size(img,1)/size(img,2))
win = GtkWindow(f, string("Face ", indx))
showall(win)
c.draw = function(widget)
copy!(widget, imgs[indx])
Expand Down
12 changes: 6 additions & 6 deletions test/faces_utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function unzip(inputfilename, outputpath=pwd())
mkpath(outpath)
else
open(outpath, "w") do io
write(io, readall(f))
write(io, read(f))
end
end
end
Expand All @@ -22,17 +22,17 @@ end
# Yu, Hua, and Jie Yang. "A direct LDA algorithm for
# high-dimensional data—with application to face recognition."
# Pattern recognition 34.10 (2001): 2067-2070.
function lda{T}(X::AbstractMatrix{T}, group::Vector{Int})
function lda(X::AbstractMatrix{T}, group::Vector{Int}) where {T}
nd = size(X,1)
dmeans, dX = lda_prepare(X, group)
UB, SB, _ = svd(dmeans, thin=true)
ikeep = SB .>= sqrt(eps(T))*maximum(SB)
Y = UB[:,ikeep]
Z = scale(Y, 1./SB[ikeep])
Z = scale(Y, 1 ./ SB[ikeep])
projW = Z'*dX
UW, SW, _ = svd(projW, thin=true)
eigenval = 1./SW.^2
eigenvec = Z*scale(UW, 1./SW)
eigenval = 1 ./ SW.^2
eigenvec = Z*scale(UW, 1 ./ SW)
# Normalize
for j = 1:size(eigenvec,2)
evn = zero(T)
Expand All @@ -48,7 +48,7 @@ function lda{T}(X::AbstractMatrix{T}, group::Vector{Int})
return eigenvec[:,end:-1:1], eigenval[end:-1:1]
end

function lda_prepare{T}(X::AbstractMatrix{T}, group::Vector{Int})
function lda_prepare(X::AbstractMatrix{T}, group::Vector{Int}) where {T}
nd = size(X,1)
npoints = size(X,2)
xbar = zeros(T,nd)
Expand Down
4 changes: 2 additions & 2 deletions test/hittesting.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Immerse, Gtk

x = linspace(0,4pi,101)
y = sin(x)
x = range(0,stop=4pi,length=101)
y = sin.(x)

figure()
p = plot(x=x,y=y,Geom.point(tag=:dots),Geom.line(tag=:line))
Expand Down
4 changes: 2 additions & 2 deletions test/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ val = Immerse.setproperty!((hfig,:line), rand(1:5), :linewidth)
val = Immerse.setproperty!((hfig,:line), RGB(rand(),rand(),rand()), :stroke)
@test Immerse.getproperty((hfig,:line), :stroke) == [coloralpha(val)]
Immerse.setproperty!((hfig,:line), false, :visible)
@test getproperty((hfig,:line), :visible) == [false]
@test Immerse.getproperty((hfig,:line), :visible) == [false]
Immerse.setproperty!((hfig,:line), true, :visible)
@test getproperty((hfig,:line), :visible) == [true]
@test Immerse.getproperty((hfig,:line), :visible) == [true]
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ include("figs.jl")
include("properties.jl")
include("gadfly_panzoom.jl")
include("hittesting.jl")
include("faces.jl")
#include("faces.jl")

0 comments on commit dad60e9

Please sign in to comment.