-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from fact-project/SinglePulseGainCalibrationS…
…ervice A Single pulse gain calibration service to solve issue #197
- Loading branch information
Showing
29 changed files
with
160 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/fact/calibrationservice/SinglePulseGainCalibService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package fact.calibrationservice; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.joda.time.DateTime; | ||
import stream.annotations.Parameter; | ||
import stream.io.SourceURL; | ||
import stream.io.CsvStream; | ||
import stream.Data; | ||
import fact.Constants; | ||
|
||
/** | ||
* | ||
**/ | ||
public class SinglePulseGainCalibService implements CalibrationService { | ||
|
||
Logger log = LoggerFactory.getLogger(SinglePulseGainCalibService.class); | ||
|
||
boolean isInit = false; | ||
public double[] integralSinglePulseGain; | ||
|
||
@Parameter( | ||
required = false, | ||
description = "The path to the integral single pulse gain file." | ||
) | ||
SourceURL integralGainFile; | ||
|
||
public void init() { | ||
integralSinglePulseGain = new double[Constants.NUMBEROFPIXEL]; | ||
Data integralGainData = null; | ||
try { | ||
CsvStream stream = new CsvStream(integralGainFile, " "); | ||
stream.setHeader(false); | ||
stream.init(); | ||
integralGainData = stream.readNext(); | ||
|
||
for (int i = 0 ; i < Constants.NUMBEROFPIXEL ; i++){ | ||
String key = "column:" + (i); | ||
integralSinglePulseGain[i] = (Double) integralGainData.get(key); | ||
} | ||
|
||
} catch (Exception e) { | ||
log.error( | ||
"Failed to load the integral single pulse gain file: {}", | ||
e.getMessage()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public double[] getIntegralSinglePulseGain() { | ||
if (isInit == false){ | ||
init(); | ||
isInit = true; | ||
} | ||
return integralSinglePulseGain; | ||
} | ||
|
||
@Override | ||
public void reset() throws Exception { | ||
} | ||
|
||
public void setIntegralGainFile(SourceURL integralGainFile) { | ||
this.integralGainFile = integralGainFile; | ||
} | ||
|
||
public int[] getBadPixel(DateTime eventTimeStamp) {return new int[0];} | ||
|
||
public int[] getNotUsablePixels(DateTime eventTimeStamp) {return new int[0];} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.