public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static int |
absPos(int pix,
int slice,
int roi)
Absolute position in the data array by pixel and slice
|
static double[] |
arrayListToDouble(ArrayList<Double> list) |
static int[] |
arrayListToInt(ArrayList<Integer> list) |
static double[] |
arrayMultiplication(double[] a,
double[] b)
Elementwise multiplication of arrays
|
static Double |
arraySum(double[] a)
Sum up array
|
static ArrayList<Integer> |
arrayToList(int[] a)
make an Array of the type int[] into ArrayList
|
static double[] |
averageSlicesForEachPixel(double[] data)
This takes a data array (of length pixels * roi) and returns an
array(length = roi) in which each entry is the average over all the
values of the other pixels in that slice.
|
static ArrayList<PixelSet> |
breadthFirstSearch(PixelSet showerPixel)
Finds all unconnected sets of pixel in the showerPixel List and returns a
list of lists.
|
static double[] |
byteToDoubleArray(byte[] ar) |
static double |
calculateDistancePointToShowerAxis(double cogx,
double cogy,
double delta,
double x,
double y) |
static org.apache.commons.math3.stat.descriptive.DescriptiveStatistics[] |
calculateTimeseriesStatistics(double[][] data)
Calculate the statistics of given 2 dim data array, where the first field
is the pixel Id and the second the slices.
|
static void |
checkWindow(int start,
int size,
int validLeft,
int validRight) |
static double[] |
flatten2dArray(double[][] array2d)
Flatten a 2d array
|
static double[] |
floatToDoubleArray(float[] ar) |
static ZonedDateTime |
getTimeStamp(stream.Data item)
Check if the dataitem has the timestamp key, if not return the MC data default timestamp
|
static ZonedDateTime |
getTimeStamp(stream.Data item,
String timeStampKey)
Check if the dataitem has the timestamp key, if not return the MC data default timestamp
|
static int[] |
getValidPixelSetAsIntArr(stream.Data item,
int npix,
String pixelSetKey)
Return an int array with the ids of the pixelSet belonging to the given Key,
return all camera pixel Ids if the set is not existing
|
static int[] |
getValidWindow(int start,
int size,
int validLeft,
int validRight) |
static double[] |
intToDoubleArray(int[] ar) |
static void |
isKeyValid(stream.Data item,
String key,
Class<?> type)
This method tries to find the key in the data item and tries to cast them
into the type given by the type parameter.
|
static void |
mapContainsKeys(stream.Data item,
Collection<String> keys)
This is a helper method which checks if all the keys provided are in the
data item.
|
static void |
mapContainsKeys(stream.Data item,
String... keys)
This is a helper method which checks if all the keys provided are in the
data item.
|
static double[] |
shortToDoubleArray(short[] ar) |
static double[][] |
snipPixelData(double[] data,
int skipFirst,
int skipLast,
int npix,
int roi)
Convert the fact data array to a 2 dim array of pixels and slices and snip out an desired window of slices
|
static double[][] |
sortPixels(double[] data,
int numPixel)
Return a 2D array
|
static double[] |
toDoubleArray(Serializable arr)
This is method might be useful for getting stuff from the data items and, if possible, cast it into a double array.
|
static double[] |
transformToEllipseCoordinates(double x,
double y,
double cogX,
double cogY,
double delta)
Transforms camera coordinates (x, y) into longitudinal and transversal
ellipse coordinates (l, t).
|
static ZonedDateTime |
unixTimeUTCToZonedDateTime(int[] unixTimeUTC) |
static double |
valueToDouble(Serializable val) |
public static ZonedDateTime unixTimeUTCToZonedDateTime(int[] unixTimeUTC)
public static double[][] sortPixels(double[] data, int numPixel)
public static int[] getValidPixelSetAsIntArr(stream.Data item, int npix, String pixelSetKey)
public static double[] averageSlicesForEachPixel(double[] data)
data
- array of length pixels*region of interestpublic static ArrayList<PixelSet> breadthFirstSearch(PixelSet showerPixel)
showerPixel
- the list to search inpublic static ArrayList<Integer> arrayToList(int[] a)
public static double[] floatToDoubleArray(float[] ar)
public static double[] intToDoubleArray(int[] ar)
public static double[] shortToDoubleArray(short[] ar)
public static double[] byteToDoubleArray(byte[] ar)
public static double[] toDoubleArray(Serializable arr)
arr
- public static double valueToDouble(Serializable val)
public static void mapContainsKeys(stream.Data item, String... keys)
item
- keys
- public static void mapContainsKeys(stream.Data item, Collection<String> keys)
item
- keys
- public static void isKeyValid(stream.Data item, String key, Class<?> type)
item
- key
- type
- public static double[] transformToEllipseCoordinates(double x, double y, double cogX, double cogY, double delta)
x
- y
- cogX
- cogY
- delta
- public static double calculateDistancePointToShowerAxis(double cogx, double cogy, double delta, double x, double y)
public static Double arraySum(double[] a)
a
- public static double[] arrayMultiplication(double[] a, double[] b) throws ArrayStoreException
a
- b
- ArrayStoreException
public static int[] getValidWindow(int start, int size, int validLeft, int validRight)
public static void checkWindow(int start, int size, int validLeft, int validRight)
public static int absPos(int pix, int slice, int roi)
pix
- slice
- public static double[][] snipPixelData(double[] data, int skipFirst, int skipLast, int npix, int roi)
data
- skipFirst
- skipLast
- npix
- public static org.apache.commons.math3.stat.descriptive.DescriptiveStatistics[] calculateTimeseriesStatistics(double[][] data)
data
- public static double[] flatten2dArray(double[][] array2d)
array2d
- 2dim double arraypublic static ZonedDateTime getTimeStamp(stream.Data item)
item
- The event to processpublic static ZonedDateTime getTimeStamp(stream.Data item, String timeStampKey)
item
- The event to processCopyright © 2019. All rights reserved.