Reconstruction of EAS core and size¶
Core reconstruction
This module contains two classes that can be used to reconstruct HiSPARC events and coincidences. The classes know how to extract the relevant information from the station and event or cluster and coincidence. Various algorithms which do the reconstruction are also defined here. The algorithms require positions and particle densties to do the reconstruction.
Each algorithm has a reconstruct_common()
method which always requires particle denisties, x, and y positions
and optionally z positions and previous reconstruction results. The
data is then prepared for the algorithm and passed to
the reconstruct()
method which returns the
reconstructed x and y coordinates.
- class sapphire.analysis.core_reconstruction.EventCoreReconstruction(station)¶
Reconstruct core for station events
This class is aware of ‘events’ and ‘stations’. Initialize this class with a ‘station’ and you can reconstruct events using
reconstruct_event()
.- Parameters:
station –
sapphire.clusters.Station
object.
- reconstruct_event(event, detector_ids=None, initial=None)¶
Reconstruct a single event
- Parameters:
event – an event (e.g. from an events table), or any dictionary-like object containing the keys necessary for reconstructing the direction of a shower (e.g. number of mips).
detector_ids – list of the detectors to use for reconstruction. The detector ids are 0-based, unlike the column names in the esd data.
initial – dictionary with already reconstructed shower parameters.
- Returns:
(x, y) core position in m.
- reconstruct_events(events, detector_ids=None, progress=True, initials=None)¶
Reconstruct events
- Parameters:
events – the events table for the station from an ESD data file.
detector_ids – detectors which use for the reconstructions.
progress – if True show a progress bar while reconstructing.
initials – list of dictionaries with already reconstructed shower parameters.
- Returns:
(x, y) core positions in m.
- class sapphire.analysis.core_reconstruction.CoincidenceCoreReconstruction(cluster)¶
Reconstruct core for coincidences
This class is aware of ‘coincidences’ and ‘clusters’. Initialize this class with a ‘cluster’ and you can reconstruct a coincidence using
reconstruct_coincidence()
.- Parameters:
cluster –
sapphire.clusters.BaseCluster
object.
- reconstruct_coincidence(coincidence, station_numbers=None, initial=None)¶
Reconstruct a single coincidence
- Parameters:
coincidence – a coincidence list consisting of multiple (station_number, event) tuples
station_numbers – list of station numbers, to only use events from those stations.
initial – dictionary with already reconstructed shower parameters.
- Returns:
(x, y) core position in m.
- reconstruct_coincidences(coincidences, station_numbers=None, progress=True, initials=None)¶
Reconstruct all coincidences
- Parameters:
coincidences – a list of coincidences, each consisting of multiple (station_number, event) tuples.
station_numbers – list of station numbers, to only use events from those stations.
progress – if True show a progress bar while reconstructing.
initials – list of dictionaries with already reconstructed shower parameters.
- Returns:
(x, y) core positions in m.
- class sapphire.analysis.core_reconstruction.CoincidenceCoreReconstructionDetectors(cluster)¶
Reconstruct core for coincidences using each detector
Instead of using the average station particle density this class uses the particle density in each detector for the reconstruction.
- reconstruct_coincidence(coincidence, station_numbers=None, initial=None)¶
Reconstruct a single coincidence
- Parameters:
coincidence – a coincidence list consisting of multiple (station_number, event) tuples
station_numbers – list of station numbers, to only use events from those stations.
initial – dictionary with already reconstructed shower parameters.
- Returns:
(x, y) core position in m.
- class sapphire.analysis.core_reconstruction.BaseCoreAlgorithm¶
No actual core reconstruction algorithm
Simply returns (nan, nan) as core.
- classmethod reconstruct_common(p, x, y, z=None, initial=None)¶
Reconstruct core position
- Parameters:
p – detector particle density in m^-2.
x,y – positions of detectors in m.
z – height of detectors in m.
initial – dictionary containing values from previous reconstructions.
- Returns:
reconstructed core position.
- static reconstruct()¶
Reconstruct core position
- Returns:
reconstructed core position.
- class sapphire.analysis.core_reconstruction.CenterMassAlgorithm¶
Simple core estimator
Estimates the core by center of mass of the measurements.
- classmethod reconstruct_common(p, x, y, z=None, initial=None)¶
Reconstruct core position
- Parameters:
p – detector particle density in m^-2.
x,y – positions of detectors in m.
z – height of detectors is ignored.
initial – dictionary containing values from previous reconstructions.
- Returns:
reconstructed core position.
- static reconstruct(p, x, y)¶
Calculate center of mass
- Parameters:
p – detector particle density in m^-2.
x,y – positions of detectors in m.
- Returns:
reconstructed core position.
- class sapphire.analysis.core_reconstruction.AverageIntersectionAlgorithm¶
Core estimator
To the densities in 3 stations correspond 2 possible cores. The line through these points is quite stable for the lateral distribution function. To each combination of 3 stations out of a set of at least 4 stations hit corresponds a line. To each combinations of 2 lines out of the set of lines corresponds a point of intersection (if the 2 lines are not collinear). Taking the cloud of intersection points close to the core estimated by the center of mass, and averaging the positions in this cloud results in an estimation for the core.
- classmethod reconstruct_common(p, x, y, z=None, initial=None)¶
Reconstruct core
- Parameters:
p – detector particle density in m^-2.
x,y – positions of detectors in m.
z – height of detectors is ignored.
initial – dictionary containing values from previous reconstructions.
- Returns:
reconstructed core position.
- static select_newlist(newx, newy, xpointlist, ypointlist, distance)¶
Select intersection points in square around the mean of old list.
- class sapphire.analysis.core_reconstruction.EllipsLdfAlgorithm¶
Simple core estimator
Estimates the core by center of mass of the measurements.
- classmethod reconstruct_common(p, x, y, z=None, initial=None)¶
Reconstruct core position
- Parameters:
p – detector particle density in m^-2.
x,y – positions of detectors in m.
z – height of detectors is ignored.
initial – dictionary containing values from previous reconstructions: zenith and azimuth.
- Returns:
reconstructed core position.
- classmethod reconstruct(p, x, y, theta, phi)¶
Reconstruct the number of electrons that fits best.
- Parameters:
p – detector particle density in m^-2.
x,y – positions of detectors in m.
theta,phi – zenith and azimuth angle in rad.
- Returns:
reconstructed core position, chi square, and shower size.
- static selectbest(p, x, y, xstart, ystart, factorbest, chi2best, gridsize, theta, phi)¶
selects the best core position in grid around (xstart, ystart).
- Parameters:
p – detector particle density in m^-2.
x,y – positions of detectors in m.
xcmass,ycmass – start position of core in m.