Skip to content

Instantly share code, notes, and snippets.

@kersulis
Created July 23, 2015 21:59
Show Gist options
  • Save kersulis/40c9c03ecdd9efa14831 to your computer and use it in GitHub Desktop.
Save kersulis/40c9c03ecdd9efa14831 to your computer and use it in GitHub Desktop.
Code coverage file for MatpowerCases.jl. Something about this file may be causing this: https://github.com/IainNZ/Coverage.jl/issues/75
- module MatpowerCases
- using MAT
-
- export loadcase,casenames
-
- """ Return a Dict containing power system data
- in MATPOWER's format.
- Return this list of cases by running casenames().
- """
- function loadcase(caseName::ASCIIString; describe=true)
31 s = joinpath(Pkg.dir(),"MatpowerCases","data")
31 p = joinpath(s,"$(caseName).mat")
31 if !isfile(p)
0 error("No data for network \"$(caseName)\".\nUse casenames() to list all valid names.")
- end
31 mpc = matread(p)["mpc"]
31 ds = mpc["docstring"]
31 if describe
0 println(split(ds,"\n")[1])
- end
31 return mpc
- end
-
- """ Return an array containing all valid
- MatpowerCases case names.
- """
- function casenames()
2 s = joinpath(Pkg.dir(),"MatpowerCases","data")
2 names = readdir(s)
2 [splitext(name)[1] for name in names]
- end
-
- end
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment