Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single pulse extraction improvement #164

Merged
merged 102 commits into from
Nov 25, 2016
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
8b12345
initial commit: Calculate the Statistics of Pixel Arrays
jebuss Sep 20, 2016
2b8bdf6
write residual timeline to data item
jebuss Sep 20, 2016
879dcb2
implemented based on processor time row features. Deleted anything no…
jebuss Sep 20, 2016
9147e21
renamed time row features to time series features
jebuss Sep 20, 2016
4365c3e
changed lying documentation
jebuss Sep 20, 2016
d53d235
Merge remote-tracking branch 'origin/master' into singlePulseExtracti…
jebuss Oct 28, 2016
7427bba
make applyAcCoupling have double[] return value
jebuss Oct 28, 2016
8b4168e
add tests for ApplyAcCoupling

jebuss Oct 28, 2016
3be48d9
Revert "make applyAcCoupling have double[] return value"
jebuss Oct 28, 2016
9ad81c0
make it work with void function
jebuss Oct 28, 2016
e70b581
bugfix: apllyAcCoupling also at beginning of singlePeExtraction
jebuss Oct 28, 2016
0b05075
bugfix: elementwise add to timeline in place
jebuss Oct 28, 2016
48852bf
add .project
jebuss Oct 28, 2016
543338e
Revert "bugfix: elementwise add to timeline in place"
jebuss Oct 28, 2016
523d434
Revert "bugfix: apllyAcCoupling also at beginning of singlePeExtraction"
jebuss Oct 28, 2016
ef23565
Revert "make it work with void function"
jebuss Oct 28, 2016
bcde975
Revert "Revert "make applyAcCoupling have double[] return value""
jebuss Oct 28, 2016
6f6bd15
Revert "make applyAcCoupling have double[] return value"
jebuss Oct 28, 2016
a1ed9c2
Revert "Revert "make it work with void function""
jebuss Oct 28, 2016
dbfd7e3
uncomment application of ac coupling since this is cousing artefacts
jebuss Oct 28, 2016
0938a42
use primitive arrays instead of ArrayList
jebuss Oct 28, 2016
f27e424
use primitive arrays instead of ArrayList
jebuss Oct 28, 2016
2e7ae12
use primitive arrays instead of ArrayList
jebuss Oct 28, 2016
93c5ad2
uncomment fixed ac coupling application, since this is still producin…
jebuss Oct 28, 2016
490e602
delete obsolete function
jebuss Oct 28, 2016
199c16e
delete getter functions
jebuss Oct 28, 2016
9ec89bb
initial commit: process to reconstruct TS from SPE
jebuss Oct 28, 2016
d74a78d
use multi dim arrays instead of array lists
jebuss Oct 28, 2016
fb25cf0
the negative template pulse for subtraction does not need to be initi…
Oct 29, 2016
5da7cfc
Instead of an subtraction of the mean, we now only subtract the minim…
Oct 29, 2016
9118ee8
need to test the global subtraction of minimum on a timeseries
Oct 29, 2016
c2d7414
rename to negative pulse, and move creation of negative pulse out of …
Oct 30, 2016
bb646f3
fix sub's'traction typo
Oct 30, 2016
eebbe99
introduce a local, sliding baseline estimator
Oct 30, 2016
311dfcf
acCoupling is obsolete
Oct 30, 2016
ce0e202
add functiom to convert from normalized singlePulse to millivolt
jebuss Oct 31, 2016
8d591c1
convert reconstructed pulse from normalized to mV
jebuss Oct 31, 2016
797e469
this was inteded to be 20 not 25. Even in the comment above it says 2…
Oct 31, 2016
1244313
Use a different method to compensate baseline floating. Now the mean …
Oct 31, 2016
bf453aa
the extraction oreder of the pulses changed. The amplitude (number co…
Oct 31, 2016
74fe6c8
removed obsolete subtraction function
Oct 31, 2016
079d0f8
convert puls amplitudes to milli Volt amplitudes to reassamble the re…
Oct 31, 2016
e6ea30f
use primitive int array for input instead of array list and renamed p…
jebuss Oct 31, 2016
92603eb
delete unused imports
jebuss Oct 31, 2016
775459a
Revert "add functiom to convert from normalized singlePulse to milliv…
jebuss Oct 31, 2016
7a7fb5b
Revert "convert reconstructed pulse from normalized to mV"
jebuss Oct 31, 2016
bfdb89a
Merge branch 'singlePulseExtractionImprovement' of https://github.com…
Oct 31, 2016
e9dbe77
Rename call of processor from TimerowFeatures to TimeseriesFeatures
Oct 31, 2016
132482d
add fixme comment
jebuss Oct 31, 2016
451e674
50 pulses is to few for the example data provided in fact-tools, bett…
Oct 31, 2016
4ee9d4c
Merge branch 'singlePulseExtractionImprovement' of https://github.com…
jebuss Oct 31, 2016
2e4ea3e
Merge branch 'singlePulseExtractionImprovement' of https://github.com…
jebuss Oct 31, 2016
bcfa178
the plateau length is just 0-offsetslices.
Nov 2, 2016
7d0b7ac
hide the tedious for loops for the elementwise operations on the arra…
Nov 2, 2016
8bb76f5
a new API with no more static and global members
Nov 11, 2016
fa56dd9
single line is fine now
Nov 11, 2016
eeb77f5
remove the cumbersome amplitude conversion function (mV <-> p.e) of t…
Nov 11, 2016
5cd2981
move the Config class for the single pulse extractor into the SingleP…
Nov 11, 2016
9845a5c
less noise
Nov 11, 2016
a970510
use function names instead of comments to structure the constructor
Nov 11, 2016
3aeac06
New API with SinglePulseExtractor.Result class used as return value c…
Nov 14, 2016
c9bb80f
store and apply the reconstructed baseline of the single pulse extractor
Nov 14, 2016
a2b922c
reuse existing mean calculation
Nov 14, 2016
18a0a0c
movingAverage array only taken from data item if a valid movingAverag…
jebuss Nov 14, 2016
1479527
rename all 'timeLine' to 'timeSeries', as 'timeSeries' is the more co…
Nov 14, 2016
4c6fc22
more consistent naming
Nov 14, 2016
55b5445
use propper camel case
Nov 14, 2016
eef8f86
delete unused imports
jebuss Nov 14, 2016
788ad7d
delete redundant cast
jebuss Nov 14, 2016
c569091
delete getter
jebuss Nov 14, 2016
41db6da
delete unused imports
jebuss Nov 14, 2016
55385b6
delete redundant datatype definition in declaration of ArrayList
jebuss Nov 14, 2016
6be43f7
move flatten to Utils
jebuss Nov 14, 2016
f9a7fee
refactor flatten function name
jebuss Nov 14, 2016
68a84b7
delete unused imports
jebuss Nov 14, 2016
8c19ef7
add autor
jebuss Nov 14, 2016
c01f130
move to java 8
jebuss Nov 14, 2016
ba98838
replace by array falltening from java 8
jebuss Nov 14, 2016
0143c86
rename function
jebuss Nov 14, 2016
b8ef882
add unit test for empty array
jebuss Nov 14, 2016
7c00b64
rename variable
jebuss Nov 14, 2016
07458c8
add documentation
jebuss Nov 14, 2016
1857b3c
drop java7 support
jebuss Nov 14, 2016
ff9bcdb
Merge pull request #160 from fact-project/NonStaticAPIforSinglePulseE…
Nov 14, 2016
c2443a7
example process for the a stad analysis with the single pe reconstruc…
jebuss Nov 15, 2016
a99c4d2
use java8 methods to walk recursively through examples/studies
jebuss Nov 15, 2016
f904dbd
example process for the a std analysis with the single pe reconstruction
jebuss Nov 15, 2016
ef80a06
minimal example for a process with the singlePeExttactor
jebuss Nov 16, 2016
3612282
deleted unecessary stuff
jebuss Nov 16, 2016
1c39808
Update pom.xml
Nov 21, 2016
373ebae
Update CHANGELOG.md
Nov 21, 2016
5f33ea6
delete unsed import
jebuss Nov 25, 2016
f381ee7
add me to creators
jebuss Nov 25, 2016
2d134d9
make maxIterations not required
jebuss Nov 25, 2016
47faa2a
add maxIterations default value
jebuss Nov 25, 2016
3a67ef9
add maxIterations key to data item
jebuss Nov 25, 2016
ad63a81
delete unsed import
jebuss Nov 25, 2016
9a66be7
Merge branch 'singlePulseExtractionImprovement' of https://github.com…
jebuss Nov 25, 2016
7661b1b
Update viewer.xml
jebuss Nov 25, 2016
b00cc13
Update singlePeMinimalExample.xml
jebuss Nov 25, 2016
3cf0c12
Update std_analysis_on_reconstructed_data.xml
jebuss Nov 25, 2016
cf6e30b
Update CHANGELOG.md
jebuss Nov 25, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ docs.idx

#intellij stuff
.idea/
.project

out/

Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: java
sudo: false
script: mvn clean verify
jdk:
- openjdk7
- oraclejdk8

after_script:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#Changelog for the fact-tools

## Version 0.17.0 -- 21.11.2016

* Improvements on Single Pulse Extractor
* No more static API, now several instances of the SinglePulseExtractor can run in parallel with different settings.
* No more static (global) variable to steer the behaviour of the SinglePulseExtractor.
* Reconstruction of amplitude time series from the photon stream (`fact.utils.ConvertSinglePulses2Timeseries`).
* Use Java 8

## Version 0.16.2 -- 26.10.2016

* ZFitsStream
Expand Down
2 changes: 1 addition & 1 deletion examples/studies/pedestalNsbStudy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<fact.extraction.RisingEdgeForPositions dataKey="DataCalibrated" amplitudePositionsKey="maxPos" outputKey="arrivalTimePos" maxSlopesKey="maxSlopesPos" />
<fact.extraction.RisingEdgePolynomFit dataKey="DataCalibrated" risingEdgeKey="arrivalTimePos" outputKey="arrivalTime" numberOfPoints="11" maxSlopesKey="maxSlopes" />
<fact.filter.MovingAverage key="DataCalibrated" outputKey="DataSmothed" length="5" />
<fact.statistics.TimerowFeatures dataKey="DataCalibrated" movingAverageKey="DataSmothed" searchWindowLeft="35" searchWindowRight="200" outputKey="voltages" />
<fact.statistics.TimeseriesFeatures dataKey="DataCalibrated" movingAverageKey="DataSmothed" searchWindowLeft="35" searchWindowRight="200" outputKey="voltages" />
<!--<fact.features.TimeSpread weightsKey="photoncharge" arrivalTimeKey="arrivalTime" showerKey="shower" outputKey="Timespread" />-->
<!---->
<fact.extraction.WaveformFluctuation key="DataCalibrated" outputKey="Nsb" skipFirst="35" skipLast="100" windowSize="30" />
Expand Down
57 changes: 57 additions & 0 deletions examples/studies/singlePeExtractor/singlePeMinimalExample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<container>

<properties url="classpath:/default/settings.properties" />

<property name="infile" value="file:src/main/resources/testDataFile.fits.gz" />
<property name="drsfile" value="file:src/main/resources/testDrsFile.drs.fits.gz" />

<property name="integralGainFile" value="classpath:/default/gain_sorted_20131127.csv" />
<property name="pixelDelayFile" value="classpath:/default/delays_lightpulser_20150217.csv" />

<property name="output" value="file:testoutfile.json" />

<property name="auxFolder" value="file:src/main/resources/aux/" />
<service id="auxService" class="fact.auxservice.AuxFileService" auxFolder="${auxFolder}" />

<service id="calibService" class="fact.calibrationservice.ConstantCalibService" />

<!--In case you want to analyze .zfits files.-->
<!-- <stream id="fact" class="fact.io.zfits.ZFitsStream" url="${infile}"/> -->

<stream id="fact" class="fact.io.FitsStream" url="${infile}"/>

<process id="2" input="fact">
<!-- prevEventAndSkip: -->
<!-- PreviousEventInfo, Skip(no Data Trigger) -->
<include url="classpath:/default/data/prevEventAndSkip.xml" />
<!-- Output: Data -->

<!-- Calibration: -->
<!-- DrsCalibration, PatchJumpRemoval, RemoveSpikes,
DrsTimeCalibration, ArrayTimeCorrection, InterpolateBadPixel -->
<include url="classpath:/default/data/calibration.xml" />
<!-- Output: DataCalibrated -->

<!-- Single Pe Extraction -->
<fact.extraction.SinglePulseExtraction
dataKey="DataCalibrated"
outputKey="PhotonArrivals"
maxIterations="4000"
/>

<!-- Data Time Series Reconstruction from Single Pe Data -->
<fact.utils.ConvertSinglePulses2Timeseries
singlePulsesKey="PhotonArrivals"
baseLineKey="PhotonArrivalsBaseLine"
timeSeriesKey="DataReconstructed"
/>

<!--<fact.ShowViewer key="DataCalibrated" />-->

<!--<fact.io.JSONWriter keys="${keysForOutput}"-->
<!--url="${output}"-->
<!--writeListOfItems="True"-->
<!--pixelSetsAsInt="True"-->
<!--/>-->
</process>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<container>

<properties url="classpath:/default/settings.properties" />

<property name="infile" value="file:src/main/resources/testDataFile.fits.gz" />
<property name="drsfile" value="file:src/main/resources/testDrsFile.drs.fits.gz" />

<property name="integralGainFile" value="classpath:/default/gain_sorted_20131127.csv" />
<property name="pixelDelayFile" value="classpath:/default/delays_lightpulser_20150217.csv" />

<property name="output" value="file:testoutfile.json" />

<property name="auxFolder" value="file:src/main/resources/aux/" />
<service id="auxService" class="fact.auxservice.AuxFileService" auxFolder="${auxFolder}" />

<service id="calibService" class="fact.calibrationservice.ConstantCalibService" />

<!--In case you want to analyze .zfits files.-->
<!-- <stream id="fact" class="fact.io.zfits.ZFitsStream" url="${infile}"/> -->

<stream id="fact" class="fact.io.FitsStream" url="${infile}"/>

<process id="2" input="fact">
<!-- prevEventAndSkip: -->
<!-- PreviousEventInfo, Skip(no Data Trigger) -->
<include url="classpath:/default/data/prevEventAndSkip.xml" />
<!-- Output: Data -->

<!-- Calibration: -->
<!-- DrsCalibration, PatchJumpRemoval, RemoveSpikes,
DrsTimeCalibration, ArrayTimeCorrection, InterpolateBadPixel -->
<include url="classpath:/default/data/calibration.xml" />
<!-- Output: DataCalibrated -->

<!-- Single Pe Extraction -->
<fact.extraction.SinglePulseExtraction
dataKey="DataCalibrated"
outputKey="PhotonArrivals"
maxIterations="4000"
/>

<!-- Data Time Series Reconstruction from Single Pe Data -->
<fact.utils.ConvertSinglePulses2Timeseries
singlePulsesKey="PhotonArrivals"
baseLineKey="PhotonArrivalsBaseLine"
timeSeriesKey="DataCalibrated"
/>


<!-- Extraction -->
<!-- BasicExtraction, RisingEdgeForPositions, RisingEdgePolynomFit, TimeOverThreshold,
PhotonChargeTimeOverThreshold, HandleSaturation, CorrectPixelDelays-->
<include url="classpath:/default/data/extraction.xml" />
<!-- Output: photoncharge, arrivalTime -->

<!-- Cleaning -->
<!-- SourcePosition(Cetatauri), CoreNeighborCleanTimeNeighbor-->
<include url="classpath:/default/data/cleaning.xml" />
<!-- Output: shower -->

<!-- Parameter calculation (only source independent) -->
<!-- ArrayMean(photoncharge,arrivalTime), ArrayStatistics(photoncharge,arrivalTime,maxSlopes,
arrivalTimePos,maxSlopesPos,maxAmplitudePosition,photonchargeSaturated,arrivalTimeTOT),
Size, DistributionFromShower, M3Long, Length, Width, NumberOfIslands, TimeGraident,
Concentration, ConcentrationCore, ConcentrationAtCenterOfGravity, Leakage, TimeSpread,
ShowerSlope, Disp -->
<include url="classpath:/default/data/parameterCalc.xml" />
<!-- Output: source independent parameters -->

<!-- Parameter calculation (only source dependent) -->
<!-- SourcePosition(${sourcename}), AntiSourcePosition(5), Alpha(for 6 Sources),
Distance(for 6 Sources), CosDeltaAlpha(for 6 Sources), Theta(for 6 Sources) -->
<include url="classpath:/default/data/sourceParameter.xml" />
<!-- Output: source dependent parameters -->

<!--<fact.ShowViewer key="DataCalibrated" />-->

<fact.io.JSONWriter keys="${keysForOutput}"
url="${output}"
writeListOfItems="True"
pixelSetsAsInt="True"
/>
</process>
</container>
8 changes: 7 additions & 1 deletion examples/viewer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
<fact.extraction.SinglePulseExtraction
dataKey="DataCalibrated"
outputKey="PhotonArrivals"
maxIterations="50"
maxIterations="1000"
/>

<fact.utils.ConvertSinglePulses2Timeseries
singlePulsesKey="PhotonArrivals"
baseLineKey="PhotonArrivalsBaseLine"
timeSeriesKey="ReconstructedDataCalibrated"
/>

<fact.ShowViewer key="DataCalibrated" />
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>de.sfb876</groupId>
<artifactId>fact-tools</artifactId>
<name>fact-tools</name>
<version>0.16.2</version>
<version>0.17.0</version>
<url>http://sfb876.de/fact-tools/</url>

<description>
Expand Down Expand Up @@ -330,6 +330,14 @@
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/fact/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.DoubleStream;

import org.apache.commons.lang3.ArrayUtils;
/**
Expand Down Expand Up @@ -522,4 +523,17 @@ public static DescriptiveStatistics[] calculateTimeseriesStatistics(double[][]
return pixelStatistics;
}


/**
* Flatten a 2d array
*
* @param array2d 2dim double array
* @return flattend double array
*/
public static double[] flatten2dArray(double[][] array2d) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sure we need an extra function for this. The one line you wrote here is pretty nice and already right? Maybe it can be used directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to keep this for now.

return Arrays.stream(array2d)
.flatMapToDouble(Arrays::stream)
.toArray();
}

}
Loading