[julia-users] IJulia: Swap shift-enter for enter?

2015-06-02 Thread RecentConvert
Is it possible to swap shift-enter for enter in IJulia?

At the moment I use Sublime for my Julia coding but despite using it for 
months now I find shift-enter to execute to be a royal pain. No other 
program I use does this. I don't mind it in my scripts but in the command 
line I find it annoying.

Given that it comes from the usage case of iPython notebooks it makes sense 
for them to have shift-enter to execute. I generally like the functionality 
of Sublime and haven't had time to find a suitable replacement, if there is 
one, which doesn't require shift-enter.


Re: [julia-users] Julia iPython notebook doesn't display inline graphics

2014-12-16 Thread RecentConvert
In my case the problem turned out to be my .juliarc.jl file. My guess is 
that loading PyPlot there had caused plots to be plotted in a separate 
window. The result of the same command are still "qt4agg".


Re: [julia-users] Julia iPython notebook doesn't display inline graphics

2014-12-11 Thread RecentConvert
using PyPlot
PyPlot.backend

"qt4agg"


Re: [julia-users] Julia iPython notebook doesn't display inline graphics

2014-12-09 Thread RecentConvert
It's not working for me either. PyPlot will plot to an external window but 
I can't seem to get it to plot inline in the notebook. I've even tried 
other input arguments as well with no luck.

ipython notebook --matplotlib=qt --profile=julia

Kubuntu 14.04 64-bit
Qt 4.8.6
Julia Version 0.3.2
Commit 8227746* (2014-10-21 22:05 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
  WORD_SIZE: 64
   Ubuntu 14.04.1 LTS
  uname: Linux 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 
2014 x86_64 x86_64
Memory: 15.586982727050781 GB (10886.7734375 MB free)
Uptime: 31616.0 sec
Load Avg:  0.3779296875  0.29638671875  0.2958984375
Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz: 
   speed user nice  sys idle  
irq
#1   800 MHz 159332 s   3587 s  63328 s2834790 s  8 
s
#2   800 MHz 162030 s   4625 s  59546 s2828052 s  0 
s
#3  3201 MHz 162877 s   5141 s  61669 s2804879 s  1 
s
#4   800 MHz 153968 s   5087 s  64039 s2836716 s  0 
s

  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3
Environment:
  TERM = xterm
  XDG_SESSION_PATH = /org/freedesktop/DisplayManager/Session0
  XDG_SEAT_PATH = /org/freedesktop/DisplayManager/Seat0
  DEFAULTS_PATH = /usr/share/gconf/kde-plasma.default.path
  PATH = 
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
  MANDATORY_PATH = /usr/share/gconf/kde-plasma.mandatory.path
  HOME = /home/somebody
  PROFILEHOME = 
  QT_PLUGIN_PATH = 
/home/somebody/.kde/lib/kde4/plugins/:/usr/lib/kde4/plugins/
  PYTHONHOME = /usr:/usr

Package Directory: /home/somebody/.julia/v0.3
6 required packages:
 - DataFrames0.5.12
 - Dates 0.3.2
 - Distributions 0.6.1
 - IJulia0.1.16
 - PyPlot1.4.3
 - ZMQ   0.1.15
18 additional packages:
 - ArrayViews0.4.8
 - BinDeps   0.3.7
 - Color 0.3.14
 - Compat0.2.5
 - DataArrays0.2.5
 - FixedPointNumbers 0.0.6
 - GZip  0.2.13
 - JSON  0.3.9
 - LaTeXStrings  0.1.2
 - Nettle0.1.7
 - PDMats0.3.1
 - PyCall0.7.1
 - REPLCompletions   0.0.3
 - Reexport  0.0.2
 - SHA   0.0.3
 - SortingAlgorithms 0.0.2
 - StatsBase 0.6.10
 - URIParser 0.0.3



[julia-users] Re: PyPlot.plot_date: How do I alter the time format?

2014-11-27 Thread RecentConvert
That's it! It should help with translating more things as well. It hadn't 
crossed my mind that I could access matplotlib in this manner.

# Julia 0.3.2
# 27.11.2014

using PyPlot
using Dates

# Create Data
dt = Millisecond(100)
time = [DateTime(2014,11,20):dt:DateTime(2014,11,22)]
y = fill!(Array(Float64,length(time)),42)
#y = floor(100*rand(length(time))) # Fails unless the time span is very 
short

font1 = ["fontname"=>"Sans","style"=>"normal"]
time2 = float64(time)/1000/60/60/24 # Convert time from milliseconds from 
day 0 to days from day 0
timespan = "\n" * Dates.format(minimum(time),"-mm-dd HH:MM:SS") * " - " 
* Dates.format(maximum(time),"-mm-dd HH:MM:SS")

majorformatter = matplotlib[:dates][:DateFormatter]("%d.%m.%Y")
minorformatter = matplotlib[:dates][:DateFormatter]("%H:%M")
majorlocator = matplotlib[:dates][:DayLocator](interval=1)
minorlocator = matplotlib[:dates][:HourLocator](byhour=(8, 16))

# Plot
fig = figure("Test Plot",figsize=(16,10)) # Create a figure and save the 
handle
ax1 = axes()
p1 = plot_date(time2,y,linestyle="-",marker="None",label="test")
axis("tight")
title("Random Data Against Time\n" * timespan)
grid("on")
xlabel("Time")
ylabel("Stuff",fontdict=font1)
ax1[:xaxis][:set_major_formatter](majorformatter)
ax1[:xaxis][:set_minor_formatter](minorformatter)
ax1[:xaxis][:set_major_locator](majorlocator)
ax1[:xaxis][:set_minor_locator](minorlocator)
fig[:autofmt_xdate](bottom=0.2,rotation=30,ha="right")
fig[:canvas][:draw]() # Update the figure
PyPlot.tight_layout()




[julia-users] Re: PyPlot.plot_date: How do I alter the time format?

2014-11-26 Thread RecentConvert
using PyPlot
using Dates

# Create Data
dt = Millisecond(200)
time = [DateTime(2014,11,20):dt:DateTime(2014,11,24)]
y = fill!(Array(Float64,length(time)),42)
#y = floor(100*rand(length(time))) # Causes error: "OverflowError: 
Allocated too many blocks"

font1 = ["fontname"=>"Sans","style"=>"normal"]
time = float64(time)/1000/60/60/24 # Convert time from milliseconds from 
day 0 to days from day 0

# Plot
fig = figure("Test Plot",figsize=(16,10)) # Create a figure and save the 
handle
ax1 = axes()
p1 = plot_date(time,y,linestyle="-",marker="None",label="test")
axis("tight")
title("Random Data Against Time\n" * timespan)
grid("on")
xlabel("Time")
ylabel("Stuff",fontdict=font1)
fig[:autofmt_xdate](bottom=0.2,rotation=30,ha="right")
fig[:canvas][:draw]() # Update the figure
PyPlot.tight_layout()

It would be much easier to have midnight be the date and every 4, 6, or 8 
hours be time of day. I would be happy with just the dates part though.


[julia-users] PyPlot.plot_date: How do I alter the time format?

2014-11-20 Thread RecentConvert
The time format automatically updates based on the time span but at the 
time span that I'm working on it's difficult to make sense of it. How do I 
alter the time format?

The Matplotlib documentation's plot_date section 
 
says how to do it but I have had no luck doing it in Julia so far.


Re: [julia-users] Re: Module Includes Problem

2014-09-17 Thread RecentConvert
I wish this had been clearer from the start. 

My problem with *include* from the beginning was that it always seemed to 
require the full path of the file and when you're trying to write something 
for others with different paths this is impractical. *require* would seem 
to find it without the full path. Ever since I learned about LOAD_PATH and 
how to add to it I've discovered that *include* will also check there and 
that modules have issues with *require* so I'll switch them all over to 
*include*s. Finally the *include*s don't need the full path because of the 
LOAD_PATH updates.

My takeaway from all of this is that I should use includes in functions and 
modules. Should I only use *require* for loading common functions into 
Julia in the .juliarc.jl file?

Thanks for all the help.


Re: [julia-users] Re: Module Includes Problem

2014-09-16 Thread RecentConvert
include("O:\\Code\\Julia\\dirlist.jl") does ineed work

dirlist.jl does not call or define any modules


[julia-users] Re: Module Includes Problem

2014-09-16 Thread RecentConvert
My .juliarc.jl file has three sections: the first adds any paths to 
LOAD_PATH, the second loads common modules including the Aerodyne one I am 
having issues with, and the final one is a list of requires of common 
functions I use including dirlist.jl. Aerodyne does call it earlier as a 
require when it is loaded as well.

# 3 methods for generic function "dirlist":
dirlist() at O:\Code\Julia\dirlist.jl:11
dirlist(directory::ASCIIString) at O:\Code\Julia\dirlist.jl:32
dirlist(directories::Array{ASCIIString,1}) at O:\Code\Julia\dirlist.jl:36


[julia-users] Re: Module Includes Problem

2014-09-15 Thread RecentConvert
dirlist.jl is a custom function that I made. The fourth line is the require 
and the line I singled out actually calls it. I've already debugged 
dirlist.jl for Julia 0.3 and have used it in other functions but this is my 
only module. At the moment I don't have access to my code but I can post 
anything needed on Wednesday at the earliest.

Windows 7
Julia Version 0.3.0
Commit 7681878 (2014-08-20 20:43 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5 CPU 670  @ 3.47GHz
  WORD_SIZE: 64
   Microsoft Windows [Version 6.1.7601]


[julia-users] Module Includes Problem

2014-09-15 Thread RecentConvert
I created a module to load and parse a set collection of data files. It 
worked in Julia 0.2. Here is the module with hopefully only the 
non-relevant code removed.

module Aerodyne

using DataFrames
using Dates
require("dirlist.jl")

export Status, aerodyne, aerodyne_load

type Status
# Constructor for Status type
function Status{T<:Int64}(vals::DataFrames.DataArray{T,1})
Status(vector(vals))
end # End Status{T<:Int64}(vals::DataFrames.DataArray{T,1}) constructor

# Constructor for Status type
function Status(vals::Array{Int64})
end # End of constructor
end # End of type

function aerodyne_load(Dr::String,mindate::DateTime)
end # End of aerodyne_load(Dr::String,mindate::DateTime)

function aerodyne_load(Dr::String,mindate::DateTime,maxdate::DateTime)
## Load STR and STC files in the given directory (Dr) between the given 
dates ##

# Check for Directory
if isdir(Dr) == false
error("First input should be a directory")
end

# List Files
(Fstr,folders) = dirlist(Dr,regex=r"\.str$") # List STR files # Line 140
(Fstc,folders) = dirlist(Dr,regex=r"\.stc$") # List STC files
end # End of aerodyne_load(Dr::String,mindate::DateTime,maxdate::DateTime)

function aerodyne_load{T<:String}(F::Array{T,1})
end # End aerodyne_load(F::Array{String,1})

function parse_time{T<:String}(F::Array{T,1})
end # End of parse_time(F::Array{String,1})

function aerodyne_load(F::String)
end # End of aerodyne_load(F::String)

function aerodyne()
end # End of aerodyne()

end # End of module

The error that is returned is as follows.

ERROR: dirlist not defined
while loading O:\Code\Julia\qcl_plot_basic.jl, in expression starting on 
line 34
while loading In[4], in expression starting on line 1

 in aerodyne_load at O:\Code\Julia\Aerodyne.jl:140

Line 140 simply calls dirlist which is suppose to recursively go through a 
given directory and return files matching the input regular expression. 
dirlist.jl and the directory where all of my code resides are loaded into 
Julia every time from the .juliarc.jl file.

(Fstr,folders) = dirlist(Dr,regex=r"\.str$") # List STR files, line 140

Any ideas?


Re: [julia-users] Re: Need help on Sublime-IJulia install on Windows, Julia 0.3.0-prerelease

2014-09-12 Thread RecentConvert
Forgot to mention, I'm running it on Windows.

Julia Version 0.3.0
Commit 7681878 (2014-08-20 20:43 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5 CPU 670  @ 3.47GHz
  WORD_SIZE: 64
   Microsoft Windows [Version 6.1.7601]
  uname: MINGW32_NT-6.1 1.0.12(0.46/3/2) 2012-07-05 14:56 i686 unknown
Memory: 3.8664932250976562 GB (807.296875 MB free)
Uptime: 8179.380286 sec
Load Avg:  0.0  0.0  0.0
Intel(R) Core(TM) i5 CPU 670  @ 3.47GHz:
   speed user   nicesys   idleirq ticks
#1  3458 MHz1319768  0 5546146362407  38111 ticks
#2  3458 MHz 204782  0 1754387856101  27736 ticks
#3  3458 MHz1055019  0 5546616626516  26473 ticks
#4  3458 MHz  84100  0  977198054253  25162 ticks

  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Nehalem)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3
Environment:
  HOMEDRIVE = O:
  HOMEPATH = \
  HOMESHARE = \\
  PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  PYTHONHOME = C:\Anaconda

Package Directory: O:\.julia\v0.3
7 required packages:
 - DataFrames0.5.7
 - Dates 0.3.1
 - Datetime  0.1.7
 - IJulia0.1.15
 - Jewel 0.8.2
 - PyPlot1.3.3
 - ZMQ   0.1.13
28 additional packages:
 - ArrayViews0.4.6
 - BinDeps   0.3.5
 - Color 0.3.7
 - Compose   0.3.8
 - DataArrays0.2.0
 - DataStructures0.3.2
 - FactCheck 0.1.2
 - FixedPointNumbers 0.0.4
 - GZip  0.2.13
 - HTTPClient0.1.4
 - Iterators 0.1.6
 - JSON  0.3.7
 - JuliaParser   0.5.2
 - LNR   0.0.1
 - Lazy  0.4.3
 - LibCURL   0.1.4
 - LibExpat  0.0.4
 - Nettle0.1.6
 - PyCall0.4.8
 - REPLCompletions   0.0.3
 - Reexport  0.0.1
 - SHA   0.0.3
 - SortingAlgorithms 0.0.1
 - StatsBase 0.6.4
 - URIParser 0.0.2
 - URLParse  0.0.0
 - WinRPM0.1.2
 - Zlib  0.1.7


Re: [julia-users] Re: Need help on Sublime-IJulia install on Windows, Julia 0.3.0-prerelease

2014-09-12 Thread RecentConvert
I ran into the ***Kernel Died*** error as well. My directories were correct 
but it turned out a space in the absolute Julia path caused the crash. I 
wasn't sure what the escape character for the space was so I just changed 
it to an underscore and it worked.


[julia-users] Re: Problem parsing file header

2014-09-04 Thread RecentConvert
For some reason that instance of Julia 0.3 *didn't* recognize eval or a 
number of other functions. I was trying to use readtable from DataFrames 
and it didn't recognize it despite having the latest version. After doing a 
Pkg.update() only an unused package was updated so I restarted Julia. 
Afterwards everything worked. If I am able to reproduce the error I will 
try and submit a bug.

Your suggestion worked quite well. It's not something I had considered 
before because I didn't think you could give it a string until I saw 
IOBuffer used elsewhere recently.

cols = readcsv(IOBuffer(colsStr))

One problem I ran across while doing something similar is the type is 
baffling me.

julia> y = [symbol("$i") for i in cols]
4-element Array{Any,1}:
 :TIMESTAMP
 :RECORD
 :Volt_CR3000_Min
 :LoggerTemp_CR3000

julia> y = [symbol("$i") for i in 1:5]
5-element Array{Symbol,1}:
 symbol("1")
 symbol("2")
 symbol("3")
 symbol("4")
 symbol("5")

 julia> y = [symbol("$i") for i in [1:5]]
5-element Array{Symbol,1}:
 symbol("1")
 symbol("2")
 symbol("3")
 symbol("4")
 symbol("5")

Why is the first instance an Array{Any,1} where the second two are 
Array{Symbol,1}?



[julia-users] Problem parsing file header

2014-09-03 Thread RecentConvert
What is an easy way of parsing a line of comma separated double quoted 
strings into an array of strings? I have some CSV files with multiple 
headers lines. In Julia 0.2.1 I did it this way.

eval(parse("cols = [" * cols[1:end-2] * "]")) # -2 to avoid the \r\n

eval doesn't appear to exist in Julia 0.3. I could parse it all in a loop 
with a few find statements but I feel there must be a better way.


[julia-users] Re: Function vs Script

2014-09-01 Thread RecentConvert
That was it.

I switched this:

eval(parse("columns = (" * columnsStr[1:end-2] * ")")) # Convert to a 
string array

to this:

columns = []
begin
f = [0,findin(columnsStr,','),length(columnsStr)-1]
columns = Array(ASCIIString,length(f)-1)
for jj=1:1:length(f)-1
   columns[jj] = columnsStr[f[jj]+2:f[jj+1]-2]
end
end

I was able to finish the conversion. My next steps will be to convert it to 
Julia 0.3 and DateTime to Dates.


[julia-users] Re: Function vs Script

2014-09-01 Thread RecentConvert
Matlab habits die hard. The following line is the source of the problem I 
think.

eval(parse("columns = (" * columnsStr[1:end-2] * ")")) # Convert to a 
string array


The files I'm working with have headers which I'm trying to load and parse. 
The parenthesis created a tuple (I think) where I was trying to create an 
ASCIIString array. For some reason it works as a script and returns an 
Array{Any,1} but it ends up being Array{None,1} in a function. I'll switch 
over to another method and see if that works out.


[julia-users] Function vs Script

2014-08-29 Thread RecentConvert
How does Julia treat an inputless function as compared to a script with the 
same contents?

Normally I create a function by first coding it as a script as it's easier 
to access the variables for testing. Once that is done I do the simple 
conversions to a function. Unfortunately in this case it changed the 
outcome of the code. If I comment out the function line and it's 
corresponding end then the code works as it should. If I put them back in 
it fails.

The script itself sequentially loads files in groups and averages the data 
within before saving the averaged data to a new file.

Julia 0.2.1
Windows 7 64-bit
*Packages Used*

   - DataFrames
   - Datetime (I know, Dates exists but I haven't had time to make the 
   update)




[julia-users] Array{ASCIIString,1} is a problem for Array{String,1}

2014-07-07 Thread RecentConvert
I have a function which is suppose to take a variety of inputs, one of them 
is an array of file names. The problem I'm running into is that sending in 
an ASCII string array, Array{ASCIIString,1}, to a function with a more 
general definition, Array{String,1}, it give me a method error.

julia> y = ["Hello","cruel","world"] 3-element Array{ASCIIString,1}:
 "Hello"
 "cruel"
 "world"

julia> isa(y,Array{ASCIIString,1}) true
 
julia> isa(y,Array{String,1})
 false

julia> isa(y[1],String) true
 

julia> isa(y[1],ASCIIString)
 true


Why won't Array{ASCIIString,1} qualify as a Array{String,1}?


Re: [julia-users] How do I zip files?

2014-05-22 Thread RecentConvert
Unfortunately ZipFile didn't work for me and I can't find my Git account 
details at the moment to submit a bug.

julia> f = ZipFile.addfile(w,"C:\\Users\\Doe\\Desktop\\Test\\fileIO.m") 

 WARNING: ERROR: key not found: 0x
 in getindex at dict.jl:500
 in show at O:\.julia\v0.2\ZipFile\src\ZipFile.jl:162


I'll try and use a zip utility external to Julia.


[julia-users] How do I zip files?

2014-05-21 Thread RecentConvert
Is there a built-in method for zipping files or must I use an external 
program? The only hits in the docs were for zipping lists.


Re: [julia-users] Carriage return without new line

2014-04-23 Thread RecentConvert
print("hello");print("\b\b\b\
b\bworld!")


This works in the basic terminal but *not* in Julia Studio.


Re: [julia-users] Carriage return without new line

2014-04-23 Thread RecentConvert
Julia Version 0.2.1 

Commit e44b593* (2014-02-11 06:30 UTC)

Platform Info:

  System: Windows (x86_64-w64-mingw32)

Windows 7



[julia-users] Carriage return without new line

2014-04-23 Thread RecentConvert
I would like to periodically output a progress percentage but don't want a 
huge list of numbers cluttering the rest of the outputs. How can this be 
accomplished?

print("hello")
print("\rworld")


This doesn't work because \r adds a new line.


Re: [julia-users] What is the "find" command in Julia?

2014-04-16 Thread RecentConvert
Is there a faster way of doing this?

Dstr2 = Array(Float64,length(Dstc["time"])-1,2) # Preallocate averaged Dstr 
array
for i=1:1:length(Dstc["time"]) - 1
   f = find(Dstc["time"][i] .<= Dstr["time"] .< Dstc["time"][i+1])
   dN = Dstr["NH3"][f]
   
   Dstr2[i,1] = f[1]
   Dstr2[i,2] = mean(dN)
end


Dstr and Dstc are both dataframes. 


Re: [julia-users] What is the "find" command in Julia?

2014-04-15 Thread RecentConvert
Ah, that's so wonderfully easy and expected (except the dot syntax)! My 
problem in finding that via searching was that *find* is simply defined in 
various other 
contexts
.

The next problem is that I need the actual indices of the matching values 
so I can apply them to other related columns. Is there a simple function 
for this?


[julia-users] What is the "find" command in Julia?

2014-04-15 Thread RecentConvert
I have a 10 Hz data set that needs to be averaged down to 1 Hz and I'd like 
to do that by finding the 10 Hz data between two 1 Hz data points and then 
averaging it.

How do I find that data? This is quite simple in Matlab.

f = find(x >= pt1 && x < pt2)


I have no found anything similar in Julia.


[julia-users] "using " scope within a module

2014-03-28 Thread RecentConvert
What is the scope of a module loaded within another module? I ask because 
while I was examining the workings of the DataFrames module I noticed it 
had duplicate calls of the Stats module.

DataFrames.jl
 # Note that the two calls to using Stats in this file are 
 # strictly required: one pulls the names into DataFrames
 # for easy access within the module, whereas the other call
 # pushes those names into Main.
 using Stats
 using DataArrays
 

 module DataFrames
 

 
##
 ##
 ## Dependencies
 ##
 
##
 

 using Base.Intrinsics
 using DataArrays
 using GZip
 using Stats
 using SortingAlgorithms


How do these two calls to Stats differ in scope?



Re: [julia-users] Re: Build a constructor with fewer inputs than values

2014-03-27 Thread RecentConvert
It works! Thanks for the help and patience. 


Re: [julia-users] Re: Build a constructor with fewer inputs than values

2014-03-27 Thread RecentConvert
Not sure how it's suppose to go. As I understood it from the constructors 
documentation 
*new* was how it was done, not return.


Re: [julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread RecentConvert
The updated code works the same with Status([1:12]) as it does with 
vector(Dstc["StatusW"]).

type Status
   Valve1::Vector{Bool}
   Valve2::Vector{Bool}
   Valve3::Vector{Bool}
   Valve4::Vector{Bool}
   Valve5::Vector{Bool}
   Valve6::Vector{Bool}
   Valve7::Vector{Bool}
   Valve8::Vector{Bool}
 
   # Constructor for Status type
   function Status(vals::Array{Int64})
   l = int64(length(vals))
 
   Valve1 = Array(Bool,l)
   Valve2 = Array(Bool,l)
   Valve3 = Array(Bool,l)
   Valve4 = Array(Bool,l)
   Valve5 = Array(Bool,l)
   Valve6 = Array(Bool,l)
   Valve7 = Array(Bool,l)
   Valve8 = Array(Bool,l)
 
   # Parse Inputs
   for i=1:l
  # Byte 1
  Valve1[i] = vals[i] & 2^(1-1) > 0
  Valve2[i] = vals[i] & 2^(2-1) > 0
  Valve3[i] = vals[i] & 2^(3-1) > 0
  Valve4[i] = vals[i] & 2^(4-1) > 0
  Valve5[i] = vals[i] & 2^(5-1) > 0
  Valve6[i] = vals[i] & 2^(6-1) > 0
  Valve7[i] = vals[i] & 2^(7-1) > 0
  Valve8[i] = vals[i] & 2^(8-1) > 0
   end # End of conversion
 

   new(Valve1,Valve2,Valve3,Valve4,Valve5,Valve6,Valve7,Valve8)
 

   end # End of constructor
end # End of type

statuses = Status(vector(Dstc["StatusW"]))
julia> typeof(statuses) Nothing (constructor with 1 method)

julia> statuses.Valve1 ErrorException("type Nothing has no field Valve1")



julia> x = Status([1:12])

julia> typeof(x) Nothing (constructor with 1 method)

julia> x.Valve1 ErrorException("type Nothing has no field Valve1")


[julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread RecentConvert
Thanks for the quick replies.

*Purpose:* Given a double, convert it to a collection of boolean values 
representing the statuses of various valves and settings.

I'm still torn about whether I want to input an array of values and store 
arrays of statuses in one type or create an array of the type with 
individual collections. This implementation is *intended* to be for arrays. 
It's partly to teach myself Julia so learning how to do it this way is 
important but I am also open to *just do it this really easy way*. Once I 
have the parsed statuses I can use it separate calibration data from the 
rest of the data, among other things.

I call it with the following line:
statuses = Status(vector(Dstc["StatusW"]))

The original format is a data frame.

Julia Version 0.2.1 

Commit e44b593* (2014-02-11 06:30 UTC)

Platform Info:

  System: Windows (x86_64-w64-mingw32)

  WORD_SIZE: 64





[julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread RecentConvert
Is this question not clear or just uninteresting?


Re: [julia-users] Help getting started with Julia's Graphs package

2014-02-24 Thread RecentConvert
>From what I've seen on the Google group it seems like most people use an 
external package like Winston, PyPlot, or Gadfly. Searching for those might 
be a better place to start.


[julia-users] Build a constructor with fewer inputs than values

2014-02-21 Thread RecentConvert
How do I build a constructor with fewer inputs than values? I have an Int64 
array of numbers where each number represents 24 boolean values. The best 
situation would be that I could send in the array and get back a composite 
type with arrays of each component. Here is the code I've tried.

type Status Valve1::Array{Bool}
   Valve2::Array{Bool}
   Valve3::Array{Bool}
   Valve4::Array{Bool}
   Valve5::Array{Bool}
   Valve6::Array{Bool}
   Valve7::Array{Bool}
   Valve8::Array{Bool}
 
   # Constructor for Status type
   function Status(vals::Array{Int64})
   l = int64(length(vals))
 
   Valve1 = Array(Bool,l)
   Valve2 = Array(Bool,l)
   Valve3 = Array(Bool,l)
   Valve4 = Array(Bool,l)
   Valve5 = Array(Bool,l)
   Valve6 = Array(Bool,l)
   Valve7 = Array(Bool,l)
   Valve8 = Array(Bool,l)
 
   # Parse Inputs
   for i=1:l
  # Byte 1
  Valve1[i] = vals[i] & 2^(1-1) > 0
  Valve2[i] = vals[i] & 2^(2-1) > 0
  Valve3[i] = vals[i] & 2^(3-1) > 0
  Valve4[i] = vals[i] & 2^(4-1) > 0
  Valve5[i] = vals[i] & 2^(5-1) > 0
  Valve6[i] = vals[i] & 2^(6-1) > 0
  Valve7[i] = vals[i] & 2^(7-1) > 0
  Valve8[i] = vals[i] & 2^(8-1) > 0
   end # End of conversion
 

   new(Valve1,Valve2,Valve3,Valve4,Valve5,Valve6,Valve7,Valve8)
 

   end # End of constructor
end # End of type


no method convert(Type{Bool},Array{Bool,1})




[julia-users] Re: Howto: Julia x[I] = [] ?? vs Matlab x(I) = []

2014-02-10 Thread RecentConvert
I ran into this same problem recently as well. This is a hard Matlab habit 
to break and none of the solutions is intuitive. My solution involves 
preallocating a boolean array and then looping through the actual data 
checking which values I need to keep. At the end I use the boolean array to 
filter the original.

calfiles = [] # CAL Files keepfiles = repmat([true],length(filestr)) # 
Files to keep
 for i = length(filestr):-1:1
 if filestr[i][end-7:end-4] == "_CAL"
 calfiles = [calfiles,filestr[i]]
 keepfiles[i] = false # Remove CAL file from the list
 end
 end
 filestr = filestr[keepfiles] # Remove CAL files




[julia-users] Re: Sorting and ordering

2014-02-06 Thread RecentConvert
You want sortperm . 
I ran into this problem 
recentlyas 
well.


[julia-users] Re: Does Julia support plotting?

2014-02-04 Thread RecentConvert
There is also PyPlot . If you're 
already accustomed to Python's 
Matplotliblibrary then this one might be 
for you. There is some translation from 
Python examples of course but I've done some work creating Julia 
examples
.


Re: [julia-users] Sorting Index

2014-02-04 Thread RecentConvert
That's what I was looking for.

using Datetime
using DataFrame

D = # load your data, DataFrame
time = # Parse time from your loaded data

I = sortperm(time) # Sorting index

time = time[I] # Sort time by time

Thanks.


[julia-users] Sorting Index

2014-02-04 Thread RecentConvert
Is there an easier method to obtain the sorting index given a column of 
data? In Matlab you can add a second output and it'll give you an index 
which you can apply to other related arrays.

using Datetime
using DataFrame

D = # load your data, DataFrame
time = # Parse time from your loaded data

y = [int64(time) [1:length(time)]]
I = sortrows(y,by=x->x[1]) # Sort index (by time)
I = I[1:end,2] # Remove unnecessary time column

time = time[I] # Sort time by time



Re: [julia-users] Julia Studio: Can't find a function in Distributions package

2013-12-19 Thread RecentConvert
using Stats

That works. Hopefully that means Julia Studio can bridge the gap between 
Julia Studio and the command line. I don't expect to code differently just 
for an IDE.


Re: [julia-users] Julia Studio: Can't find a function in Distributions package

2013-12-17 Thread RecentConvert
D'oh! I did all of that but forgot to post it. Here it is

Command Line: 
   methods(coef)
   # 3 methods for generic function "coef"
   coef(x::LinPredModel) at O:\.julia\GLM\src\linpred.jl:58
   coef(obj::StatisticalModel) at O:\.julia\Stats\src\others.jl:156
   coef(x::LinPred) at O:\.julia\GLM\src\linpred.jl:57
   
   Pkg.installed("Distributions")
   v"0.2.11"

Julia Studio:
   methods(coef)
   coef not defined

   Pkg.installed("Distributions")
   v"0.2.11"