Skip to content

Commit 8403d7f

Browse files
committed
Fix error in initial commit template, add documentation for encoding
1 parent 769c7eb commit 8403d7f

28 files changed

+1985
-36
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ In no event and under no legal theory, whether in tort (including negligence), c
6565

6666
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
6767

68-
END OF TERMS AND CONDITIONS
68+
END OF TERMS AND CONDITIONS

MSNumpressFSharp.sln

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B
1111
EndProject
1212
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}"
1313
EndProject
14-
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "MSNumpressFSharp", "src\MSNumpressFSharp\MSNumpressFSharp.fsproj", "{082A81A9-8F10-41E0-A567-97A23493E208}"
14+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "MSNumpressFSharp", "src\MSNumpressFSharp\MSNumpressFSharp.fsproj", "{72EA463B-C958-474C-BDDC-F5541985E33D}"
1515
EndProject
1616
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60BC93-E09B-4E5F-9D85-95A519479D54}"
1717
ProjectSection(SolutionItems) = preProject
@@ -28,13 +28,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{83F16175
2828
EndProject
2929
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D5255-776D-4B61-85F9-73C37AA1FB9A}"
3030
ProjectSection(SolutionItems) = preProject
31+
docsrc\content\Decoding.fsx = docsrc\content\Decoding.fsx
32+
docsrc\content\Encoding.fsx = docsrc\content\Encoding.fsx
3133
docsrc\content\index.fsx = docsrc\content\index.fsx
3234
docsrc\content\tutorial.fsx = docsrc\content\tutorial.fsx
3335
EndProjectSection
3436
EndProject
3537
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ED8079DD-2B06-4030-9F0F-DC548F98E1C4}"
3638
EndProject
37-
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "MSNumpressFSharp.Tests", "tests\MSNumpressFSharp.Tests\MSNumpressFSharp.Tests.fsproj", "{157660D1-5DA5-4A89-9708-CEE6CFF623A7}"
39+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "MSNumpressFSharp.Tests", "tests\MSNumpressFSharp.Tests\MSNumpressFSharp.Tests.fsproj", "{C819829A-8C8F-48DC-9C93-7DD11F08EE43}"
3840
EndProject
3941
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "git", "git", "{078A9C52-DDC1-46F4-9235-9E6C89C87AFD}"
4042
ProjectSection(SolutionItems) = preProject
@@ -45,7 +47,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "git", "git", "{078A9C52-DDC
4547
.github\CONTRIBUTING.md = .github\CONTRIBUTING.md
4648
.github\ISSUE_TEMPLATE\feature_request.md = .github\ISSUE_TEMPLATE\feature_request.md
4749
.github\ISSUE_TEMPLATE.md = .github\ISSUE_TEMPLATE.md
48-
LICENSE.txt = LICENSE.txt
4950
PULL_REQUEST_TEMPLATE.md = PULL_REQUEST_TEMPLATE.md
5051
EndProjectSection
5152
EndProject
@@ -67,14 +68,14 @@ Global
6768
Release|Any CPU = Release|Any CPU
6869
EndGlobalSection
6970
GlobalSection(ProjectConfigurationPlatforms) = postSolution
70-
{082A81A9-8F10-41E0-A567-97A23493E208}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
71-
{082A81A9-8F10-41E0-A567-97A23493E208}.Debug|Any CPU.Build.0 = Debug|Any CPU
72-
{082A81A9-8F10-41E0-A567-97A23493E208}.Release|Any CPU.ActiveCfg = Release|Any CPU
73-
{082A81A9-8F10-41E0-A567-97A23493E208}.Release|Any CPU.Build.0 = Release|Any CPU
74-
{157660D1-5DA5-4A89-9708-CEE6CFF623A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75-
{157660D1-5DA5-4A89-9708-CEE6CFF623A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
76-
{157660D1-5DA5-4A89-9708-CEE6CFF623A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
77-
{157660D1-5DA5-4A89-9708-CEE6CFF623A7}.Release|Any CPU.Build.0 = Release|Any CPU
71+
{72EA463B-C958-474C-BDDC-F5541985E33D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72+
{72EA463B-C958-474C-BDDC-F5541985E33D}.Debug|Any CPU.Build.0 = Debug|Any CPU
73+
{72EA463B-C958-474C-BDDC-F5541985E33D}.Release|Any CPU.ActiveCfg = Release|Any CPU
74+
{72EA463B-C958-474C-BDDC-F5541985E33D}.Release|Any CPU.Build.0 = Release|Any CPU
75+
{C819829A-8C8F-48DC-9C93-7DD11F08EE43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
76+
{C819829A-8C8F-48DC-9C93-7DD11F08EE43}.Debug|Any CPU.Build.0 = Debug|Any CPU
77+
{C819829A-8C8F-48DC-9C93-7DD11F08EE43}.Release|Any CPU.ActiveCfg = Release|Any CPU
78+
{C819829A-8C8F-48DC-9C93-7DD11F08EE43}.Release|Any CPU.Build.0 = Release|Any CPU
7879
{B7339FEC-0891-4DF8-8BB5-0B806A64F32F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7980
{B7339FEC-0891-4DF8-8BB5-0B806A64F32F}.Debug|Any CPU.Build.0 = Debug|Any CPU
8081
{B7339FEC-0891-4DF8-8BB5-0B806A64F32F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -86,7 +87,7 @@ Global
8687
GlobalSection(NestedProjects) = preSolution
8788
{83F16175-43B1-4C90-A1EE-8E351C33435D} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}
8889
{8E6D5255-776D-4B61-85F9-73C37AA1FB9A} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}
89-
{157660D1-5DA5-4A89-9708-CEE6CFF623A7} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
90+
{C819829A-8C8F-48DC-9C93-7DD11F08EE43} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
9091
EndGlobalSection
9192
GlobalSection(ExtensibilityGlobals) = postSolution
9293
SolutionGuid = {D55EAFC0-7966-48AB-9DF6-8CFA23ABABB1}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
This is a F# port of the C# version of the MS Numpress library. The original library can be found at https://github.com/ms-numpress/ms-numpress.
44

5-
The library provides three algorithms for compression of mass spectrometry data. One algorithm is designed for the compression of linear data like retention time or m/z data. The other two algorithms are for compression of non-linear data with lower precision requirements, such as ion count data.
5+
The library provides three algorithms for compression of mass spectrometry data. One algorithm is designed for the compression of linear data like retention time or m/z data. The other two algorithms are for compression of non-linear data with lower precision requirements, such as ion count data.

build.fsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ let githubLink = sprintf "https://github.com/%s/%s" github_release_user gitName
282282

283283
// Specify more information about your project
284284
let info =
285-
[ "project-name", "FSharpGephiStreamer"
286-
"project-author", "Timo M�hlhaus"
287-
"project-summary", "FSharp functions for streaming graph data to gephi a graph visualization tool"
285+
[ "project-name", "MSNumpressFSharp"
286+
"project-author", "Jonathan Ott"
287+
"project-summary", "F# port of the MSNumpress library."
288288
"project-github", githubLink
289-
"project-nuget", "http://nuget.org/packages/FSharpGephiStreamer" ]
289+
"project-nuget", "http://nuget.org/packages/MSNumpressFSharp" ]
290290

291291
let root = website
292292

docsrc/content/Decoding.fsx

Whitespace-only changes.

docsrc/content/Encoding.fsx

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
(*** hide ***)
2+
#I "../../bin"
3+
#r @"MSNumpressFSharp\net47\MSNumpressFSharp.dll"
4+
open MSNumpressFSharp
5+
6+
(**
7+
8+
###Numpress Pic
9+
10+
This compression algorithm is intended for ion count data.
11+
It rounds values to the nearest integer, and stores these integers in a truncated
12+
form which is effective for values relatively close to zero.
13+
14+
The encodePic function takes an array with data, the length of this array and a byte array
15+
where the encoded bytes are stored. The maximum size of the byte array is n * 5,
16+
but usually it is smaller depending on the data. The function modifies the byte array and returns
17+
the number of encoded bytes.
18+
*)
19+
20+
//sample data
21+
let dataPic = [|1. .. 100.|]
22+
23+
//empty array for the encoded bytes
24+
let byteArrayPic: byte[] = Array.zeroCreate (dataPic.Length * 5)
25+
26+
//takes data, data length and an empty array for the encoded bytes. Returns the number of encoded bytes.
27+
let encodePic = MSNumpressFSharp.Encode.encodePic (dataPic, dataPic.Length, byteArrayPic)
28+
29+
(**
30+
byteArrayPic contains now the compressed data. The byte array and number of encoded bytes is needed for
31+
decoding.
32+
33+
###Numpress Lin
34+
35+
This compression uses a fixed point representation, achieved by multiplication with a scaling factor
36+
and rounding to the nearest integer. To exploit the assumed linearity of the data, linear prediction is
37+
then used.The scaling factor can be chosen manually, but the library also contains a function for
38+
retrieving the optimal linear scaling factor for a given data array. Since the scaling factor is variable,
39+
it is stored as a regular double precision float first in the encoding, and automatically parsed during
40+
decoding.
41+
42+
The encodeLinear function takes an array with data, the length of this array, a byte array where the encoded bytes
43+
are stored and a linear scaling factor.The maximum size of the byte array is 8 + n * 5,
44+
but usually it is smaller depending on the data. The function modifies the byte array and returns
45+
the number of encoded bytes.
46+
*)
47+
48+
//sample data
49+
let dataLin = [|1. .. 100.|]
50+
51+
//empty array for the encoded bytes
52+
let byteArrayLin: byte[] = Array.zeroCreate (8 + dataLin.Length * 5)
53+
54+
//optimal scaling factor for sample data
55+
let optimalFixedPointLin = MSNumpressFSharp.Encode.optimalLinearFixedPoint (dataLin, dataLin.Length)
56+
57+
//takes data, data length, an empty array for the encoded bytes and a scaling factor. Returns the number of encoded bytes.
58+
let encodeLin = MSNumpressFSharp.Encode.encodeLinear (dataLin, dataLin.Length, byteArrayLin, optimalFixedPointLin)
59+
60+
(**
61+
byteArrayLin contains now the compressed data. The byte array and number of encoded bytes is needed for
62+
decoding.
63+
64+
###Numpress Slof
65+
66+
This function also targets ion count data. The compression takes the natural logarithm of values, multiplies it
67+
by a scaling factor and rounds to the nearest integer. For typical ion count dynamic ranges these
68+
values fits into two byte integers, so only the two least significant bytes of the integer are stored.
69+
The scaling factor can be chosen manually, but the library also contains a function for retrieving
70+
the optimal Slof scaling factor for a given data array. Since the scaling factor is variable, it is
71+
stored as a regular double precision float first in the encoding, and automatically parsed during
72+
decoding.
73+
74+
The encodeSlof function takes an array with data, the length of this array, a byte array where the encoded bytes
75+
are stored and a linear scaling factor.The maximum size of the byte array is n * 2 + 8,
76+
but usually it is smaller depending on the data. The function modifies the byte array and returns
77+
the number of encoded bytes.
78+
*)
79+
80+
//sample data
81+
let dataSlof = [|1. .. 100.|]
82+
83+
//empty array for the encoded bytes
84+
let byteArraySlof: byte[] = Array.zeroCreate (8 + dataSlof.Length * 2)
85+
86+
//optimal scaling factor for sample data
87+
let optimalFixedPointSlof = MSNumpressFSharp.Encode.optimalSlofFixedPoint (dataSlof, dataSlof.Length)
88+
89+
//takes data, data length, an empty array for the encoded bytes and a scaling factor. Returns the number of encoded bytes.
90+
let encodeSlof = MSNumpressFSharp.Encode.encodeSlof (dataSlof, dataSlof.Length, byteArraySlof, optimalFixedPointSlof)
91+
92+
(**
93+
byteArrayLin contains now the compressed data. The byte array and number of encoded bytes is needed for
94+
decoding.
95+
*)

docsrc/tools/templates/template.cshtml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,25 @@
3838
<div class="span3">
3939
<img src="@Root/img/logo.png" alt="F# Project" style="width:150px;margin:10px" />
4040
<ul class="nav nav-list" id="menu" style="margin-top: 20px;">
41-
<li class="nav-header">@Properties["project-name"]</li>
42-
<li><a href="@Root/index.html">Home page</a></li>
43-
<li class="divider"></li>
44-
<li><a href="@Properties["project-nuget"]">Get Library via NuGet</a></li>
45-
<li><a href="@Properties["project-github"]">Source Code on GitHub</a></li>
46-
<li><a href="@Root/license.html">License</a></li>
47-
<li><a href="@Root/release-notes.html">Release Notes</a></li>
48-
49-
<li class="nav-header">Getting started</li>
50-
<li><a href="@Root/tutorial.html">Sample tutorial</a></li>
41+
<li class="nav-header">@Properties["project-name"]</li>
42+
<li><a href="@Root/index.html">Home page</a></li>
43+
<li class="divider"></li>
44+
<li><a href="@Properties["project-nuget"]">Get Library via NuGet</a></li>
45+
<li><a href="@Properties["project-github"]">Source Code on GitHub</a></li>
46+
<li><a href="@Root/license.html">License</a></li>
47+
<li><a href="@Root/release-notes.html">Release Notes</a></li>
5148

52-
<li class="nav-header">Documentation</li>
53-
<li><a href="@Root/reference/index.html">API Reference</a></li>
49+
<li class="nav-header">Getting started</li>
50+
<li><a href="@Root/tutorial.html">Sample tutorial</a></li>
51+
52+
<li class="nav-header">Documentation</li>
53+
<li><a href="@Root/reference/index.html">API Reference</a></li>
54+
55+
<li class="nav-header">Encoding</li>
56+
<li><a href="@Root/reference/index.html">API Reference</a></li>
57+
58+
<li class="nav-header">Decoding</li>
59+
<li><a href="@Root/reference/index.html">API Reference</a></li>
5460
</ul>
5561
</div>
5662
</div>

src/MSNumpressFSharp/AssemblyInfo.fs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
// Auto-Generated by FAKE; do not edit
12
namespace System
23
open System.Reflection
34

45
[<assembly: AssemblyTitleAttribute("MSNumpressFSharp")>]
56
[<assembly: AssemblyProductAttribute("MSNumpressFSharp")>]
6-
[<assembly: AssemblyDescriptionAttribute("A short summary of your project.")>]
7-
[<assembly: AssemblyVersionAttribute("1.0")>]
8-
[<assembly: AssemblyFileVersionAttribute("1.0")>]
7+
[<assembly: AssemblyDescriptionAttribute("F# port of the MSNumpress library.")>]
8+
[<assembly: AssemblyVersionAttribute("0.0.1")>]
9+
[<assembly: AssemblyFileVersionAttribute("0.0.1")>]
10+
[<assembly: AssemblyConfigurationAttribute("Release")>]
911
do ()
1012

1113
module internal AssemblyVersionInformation =
12-
let [<Literal>] Version = "1.0"
14+
let [<Literal>] AssemblyTitle = "MSNumpressFSharp"
15+
let [<Literal>] AssemblyProduct = "MSNumpressFSharp"
16+
let [<Literal>] AssemblyDescription = "F# port of the MSNumpress library."
17+
let [<Literal>] AssemblyVersion = "0.0.1"
18+
let [<Literal>] AssemblyFileVersion = "0.0.1"
19+
let [<Literal>] AssemblyConfiguration = "Release"

src/MSNumpressFSharp/MSNumpress.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,4 @@ module Decode =
431431
loop (i + 2) (riV + 1)
432432
| value when value >= dataSize -> riV
433433
| _ -> failwith "Error in decodeSlof. dataSize may be wrong."
434-
loop 8 0
434+
loop 8 0

src/MSNumpressFSharp/MSNumpressFSharp.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net45;net47;netstandard2.0</TargetFrameworks>
44
<RootNamespace>MSNumpressFSharp</RootNamespace>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Auto-Generated by FAKE; do not edit
2+
namespace System
3+
open System.Reflection
4+
5+
[<assembly: AssemblyTitleAttribute("MSNumpressFSharpConsole")>]
6+
[<assembly: AssemblyProductAttribute("MSNumpressFSharp")>]
7+
[<assembly: AssemblyDescriptionAttribute("F# port of the MSNumpress library.")>]
8+
[<assembly: AssemblyVersionAttribute("0.0.1")>]
9+
[<assembly: AssemblyFileVersionAttribute("0.0.1")>]
10+
[<assembly: AssemblyConfigurationAttribute("Release")>]
11+
do ()
12+
13+
module internal AssemblyVersionInformation =
14+
let [<Literal>] AssemblyTitle = "MSNumpressFSharpConsole"
15+
let [<Literal>] AssemblyProduct = "MSNumpressFSharp"
16+
let [<Literal>] AssemblyDescription = "F# port of the MSNumpress library."
17+
let [<Literal>] AssemblyVersion = "0.0.1"
18+
let [<Literal>] AssemblyFileVersion = "0.0.1"
19+
let [<Literal>] AssemblyConfiguration = "Release"

temp/gh-pages/Decoding.html

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>Decoding</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7+
<meta name="description" content="F# port of the MSNumpress library."/>
8+
<meta name="author" content="Jonathan Ott"/>
9+
10+
<script src="https://code.jquery.com/jquery-1.8.0.js"></script>
11+
<script src="https://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
12+
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
13+
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet"/>
14+
<meta http-equiv="X-UA-Compatible" content="IE=11" >
15+
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
16+
<link type="text/css" rel="stylesheet" href="content/style.css" /> <!--/MSNumpressFSharp-->
17+
<link type="text/css" rel="stylesheet" href="style/CSBstyles.css" /> <!--/MSNumpressFSharp-->
18+
<script type="text/javascript" src="content/tips.js"></script> <!--/MSNumpressFSharp-->
19+
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
20+
<!--[if lt IE 9]>
21+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
22+
<![endif]-->
23+
</head>
24+
<body>
25+
<div class="container">
26+
<div class="masthead">
27+
<ul class="nav nav-pills pull-right">
28+
<li><a href="http://fsharp.org">fsharp.org</a></li>
29+
<li><a href="https://github.com/Joott/MSNumpressFSharp">github page</a></li>
30+
</ul>
31+
<h3 class="muted"><a href="index.html">MSNumpressFSharp</a></h3>
32+
</div>
33+
<hr />
34+
<div class="row">
35+
<div class="span9" id="main">
36+
37+
38+
39+
</div>
40+
<div class="span3">
41+
<img src="img/logo.png" alt="F# Project" style="width:150px;margin:10px" />
42+
<ul class="nav nav-list" id="menu" style="margin-top: 20px;">
43+
<li class="nav-header">MSNumpressFSharp</li>
44+
<li><a href="index.html">Home page</a></li>
45+
<li class="divider"></li>
46+
<li><a href="http://nuget.org/packages/MSNumpressFSharp">Get Library via NuGet</a></li>
47+
<li><a href="https://github.com/Joott/MSNumpressFSharp">Source Code on GitHub</a></li>
48+
<li><a href="license.html">License</a></li>
49+
<li><a href="release-notes.html">Release Notes</a></li>
50+
51+
<li class="nav-header">Getting started</li>
52+
<li><a href="tutorial.html">Sample tutorial</a></li>
53+
54+
<li class="nav-header">Documentation</li>
55+
<li><a href="reference/index.html">API Reference</a></li>
56+
57+
<li class="nav-header">Encoding</li>
58+
<li><a href="reference/index.html">API Reference</a></li>
59+
60+
<li class="nav-header">Decoding</li>
61+
<li><a href="reference/index.html">API Reference</a></li>
62+
</ul>
63+
</div>
64+
</div>
65+
</div>
66+
<a href="https://github.com/Joott/MSNumpressFSharp"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"/></a>
67+
</body>
68+
</html>

0 commit comments

Comments
 (0)