forked from amkovkov/GranuSightSoftware2
comprehensive update
1) remove unused components: camera view (due it causes segmentation faults), compute resources and all related, illuminator controller (due in useless without camera view), image storage service, temperature and humidity service 2) database schema - reduce tables references, features storing in records themselves in compressed form, add records creation and editing date and time, add separator comment column 3) analysis - rework of pipeline and ui, now database storing only raw data and all display values calculated from it 4) lights service - add reconnection if disconnected 5) add width and height command line arguments 6) fix some typos and other issues
This commit is contained in:
@@ -46,4 +46,32 @@ public static class EnumerableExtensions
|
||||
variance += Math.Pow(value - mean, 2.0);
|
||||
return variance / values.Count();
|
||||
}
|
||||
public static double StdDev(this IEnumerable<double> values) => Math.Sqrt(Variance(values));
|
||||
public static float Variance(this IEnumerable<float> values)
|
||||
{
|
||||
if (values.Count() == 1)
|
||||
return 0;
|
||||
|
||||
float mean = values.Average();
|
||||
float variance = 0.0f;
|
||||
foreach (int value in values)
|
||||
variance += MathF.Pow(value - mean, 2.0f);
|
||||
return variance / values.Count();
|
||||
}
|
||||
public static float StdDev(this IEnumerable<float> values) => MathF.Sqrt(Variance(values));
|
||||
|
||||
public static IEnumerable<IEnumerable<TValue>> Chunk<TValue>(this IEnumerable<TValue> values, IEnumerable<int> chunks)
|
||||
{
|
||||
if (chunks.Count() == 0)
|
||||
throw new InvalidDataException();
|
||||
if (values.Count() != chunks.Sum())
|
||||
throw new InvalidDataException();
|
||||
|
||||
var start = 0;
|
||||
foreach (var chunk in chunks)
|
||||
{
|
||||
yield return values.Skip(start).Take(chunk);
|
||||
start += chunk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user