alan-turing-institute / DetectorChecker

Project to develop software to assess developing detector screen damage (Web App based on the original DetectorChecker package)
https://detectorchecker.azurewebsites.net
MIT License
0 stars 1 forks source link

Implement defined-area analysis #53

Closed OscartGiles closed 5 years ago

OscartGiles commented 5 years ago

@ejulia17 will provide code for defined-area analysis which needs to be implemented in the package

ejulia17 commented 5 years ago

Yes, thanks for thinking about that indeed. I've been modifying the core lines in the code for that last week after finding an algorithm more suitable to point clouds (invoking dbscan) through testing it on a variety of simulated data sets. Need to now modify the relevant code (in a branch). I'm working on that and hope for no surprises...

I have also made the decision that this bit should not go into the web app. It is still not ready for autopilot, and that's probably not possible, but will always need try & error type of parameter adjustment. Too complex and distracting for the web app.

However, it should go into the package. Users of the package may enjoy have this to explore. More asap.

OscartGiles commented 5 years ago

Make sure vignettes are updated

OscartGiles commented 5 years ago

Julia has added code to https://github.com/alan-turing-institute/DetectorChecker/tree/Rcode_Phase1b/Original_code

under the name phase1_ModifiedAreaNew.R

OscartGiles commented 5 years ago

@ejulia17 - I have taken a first pass at implementing the defined area code analysis, which is now on the development branch.

I have added a function called remove_high_density_cluster which does this. Let me know if you think there is a better name.

Essentially it just takes a detector object, performs your analysis, and then returns a detector object with an updated pixel_matrix. The detector object also has a number of variables, like dead_stats, which the function automatically updates (for example, if the object already has dead_stats in it, these are recalculated for the detector with the high density cluster removed).

Could you take a look to make sure you are happy with it?

The easiest way to do this is to clone the repository, then checkout the development branch. Or alternatively, go to https://github.com/alan-turing-institute/DetectorChecker/tree/develop and click the clone or download icon, and download it as a zip file.

If you then open the package in R studio, you should be able to see the results by running this code::


devtools::load_all()

detector <- create_module("Excalibur")

file_path <- c("inst/extdata/Excalibur/pixelmask.fem1.hdf", 
               "inst/extdata/Excalibur/pixelmask.fem2.hdf",
               "inst/extdata/Excalibur/pixelmask.fem3.hdf",
               "inst/extdata/Excalibur/pixelmask.fem4.hdf",
               "inst/extdata/Excalibur/pixelmask.fem5.hdf",
               "inst/extdata/Excalibur/pixelmask.fem6.hdf")

detector <- load_pix_matrix(detector = detector, file_path = file_path)

# New function 
detector_mod <- remove_high_density_cluster(detector)

plot_detector_damaged(detector = detector)
plot_detector_damaged(detector = detector_mod)

Let me know if anything is unclear.

OscartGiles commented 5 years ago

Need to add this to vignettes

OscartGiles commented 5 years ago

Now added to vignettes