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

EventFileReader #283

Merged
merged 84 commits into from
Jan 12, 2017
Merged

EventFileReader #283

merged 84 commits into from
Jan 12, 2017

Conversation

watsonjj
Copy link
Contributor

Created a new component called EventFileReader. This is a base component, from which different FileReaders can inherit from and define their own methods for reading different files that contain waveforms.

The first example of a child of EventFileReader is HessioFileReader. This handles checking if the file exists, and calling hessio_event_source with the correct arguments depending on your requirements (obtain the source generator with read(), or obtain a specific event with get_event(), or even find the number of events in the file in the fastest way possible by accessing the num_events attribute.

This provides a nice way to read files in the Tool/Component framework.

Additionally, EventFileReaderFactory can be used to obtain the correct EventFileReader depending on the file path supplied, allowing full flexibility of running scripts from any file source.

This is an improvement on the old InputFile class (or the FileReader component).

This PR first needs #219 to be reviewed and merged before merging.

…egrators.py that will hold the charge extractors, formatted as Component sub-classes.
Replaced setters with check_window_width_and_start() so edits to numpy array are checked too
Added static function to ChargeExtractors to indicate if it requires the pixel neighbours
Improved structure of ChargeExtractorFactory, included method to obtain the ChargeExtractor object (get product)
Created factory_proposal as a suggestion for a Factory class to be added to core.
Cleaned up charge_extraction.py
…n_compenents

* upstream/master: (42 commits)
  upgrade astropy_helpers to v1.0.7
  fixed typos and changed line limit to 90 chars
  Improved developer documentation
  No parent as default
  Fix type in test name
  Make Component abstract
  fixed import order
  fixed typo introduced in last commit
  pep8 cleanups of the hillas code
  Fix camera example
  Fix section names in docstrings
  Remove call to non existent plot
  Fix markup errors in docstrings
  Move to newest version of astropy helpers
  Fix command in .travis.yml
  Do matplotlib import only for doc build
  Import pyplot once to get rid of font warning
  Add more config test cases (keys too long for fits), fix cta-observatory#221
  Truncate only if key and value are too long
  Use tempory files for json tests
  ...
…ndle factories

The new tool proposal first evaluates the factories, and then continues as the original Tool. Full description in class docstring.
Corrected None check in ChargeExtractorFactory
* master: (98 commits)
  Renamed request_event_id to use_event_id (missed some in last commit)
  Renamed request_event_id to use_event_id
  Corrected num_events if max_events is set
  Corrected pyhessio version in .travis.yml
  Updated .travis.yml to use latest release of pyhessio
  Corrected arguments
  get_event now returns a deepcopy (so it will always point to that event)
  change binCenter to bin_centers
  Replace  from ctapipe.io.containers import EventContainer  By  from ctapipe.io.containers import MCEventContainer
  Replace from ctapipe.io.containers import EventContainer By from ctapipe.io.containers import MCEventContainer
  Added additional pyhessio parameters
  Moved assignment of run_array_direction to correct location
  Added new pyhessio parameters
  Changed checking if file exists to be done by os module
  Updated functionality of files.py to be more intuitive (max events are now set at initialisation of InputFile object)
  Corrected for incorrect conflict resolve
  compatible with new pyhessio API
  rename mock to toymodel to avoid confusion
  updated io docs
  moved and renamed some container variables
  ...
Deleted new_tool_proposal
Updated factory_proposal to use a new simpler proposal for a factory
Updated charge_extraction and calibration_tool to use new factory_proposal
…camera_calibration_compenents

* bugfix_tools_notebook:
  Corrected bug (--log_level -> --log-level)

* colored_log_output:
  Created new logging.Formatter for Tool logger so that levels have colored format
…itialized once, with no specific waveforms, and are used many times, with the waveforms being passed in extract_charge() instead.
Created telescope_ids in InstrumentContainer which holds a list of all the telescope ids that exist in the run
Changed _fill_instrument_info to loop over data.inst.telescope_ids, instead of first attempting to fill pixel_pos
Changed inst container to be only filled once. The pyhessio function get_num_channel no longer throws an error when extracting from a telescope for which the current event has no data (cta-observatory/pyhessio#42)
Renamed CalibratedContainer to DL1Container for clarity
Removed pedestal_subtracted_adc from DL1CameraContainer as this is a part of R2 calibration
Created test for factory.py
Added Factory to __init__.py
Corrected import of Factory in charge_extractors.py
…libration_compenents

* remotes/upstream/master:
  more doc fixes to avoid sphinx warnings
  fix some documentation bugs
  small fixes
  simplify install text
  more format fixing
  fix bad formatting
  fix typo
  update readme with install instructions
  cleanups in setup.py to better work with the conda package
  moved geometry_converter from io to image
  moved handling of camera rotation angle out of rotation function
  removed local filename, switched to ctapipe-included test file
  added more documentation
  added geometry converter 1D->2D
  Use hillas_parameters_1 instead of hillas_parameters_2 because hillas_parameters does not return same object than hillas_parameters_1
  Move from mock to toymodel Get hillas from image Change overlay_moments to use new hillas

# Conflicts:
#	ctapipe/calib/camera/calibrators.py
Changed the structure of event file reading to have a parent class EventFileReader, from which child classes are produced for each type of EventFileReader e.g. HessioFileReader
The correct file reader can be obtained from the input file (or specified by the user) by using EventFileReaderFactory
Updated examples/display_integrator.py to use the EventFileReaderFactory
Changed the default output directory path for examples/display_integrator.py to be inside the current directory
…strument

* remotes/upstream/master:
  more doc fixes to avoid sphinx warnings
  fix some documentation bugs
  small fixes
  simplify install text
  more format fixing
  fix bad formatting
  fix typo
  update readme with install instructions
  cleanups in setup.py to better work with the conda package
  moved geometry_converter from io to image
  moved handling of camera rotation angle out of rotation function
  Corrected bug (--log_level -> --log-level)
  removed local filename, switched to ctapipe-included test file
  added more documentation
  added geometry converter 1D->2D
  Use hillas_parameters_1 instead of hillas_parameters_2 because hillas_parameters does not return same object than hillas_parameters_1
  Move from mock to toymodel Get hillas from image Change overlay_moments to use new hillas
Corrected axis labels in examples/display_integrator.py
@watsonjj watsonjj mentioned this pull request Dec 15, 2016
@kosack
Copy link
Contributor

kosack commented Jan 6, 2017

can't be merged until you resolve conflicts

Copy link
Contributor

@kosack kosack left a comment

Choose a reason for hiding this comment

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

need to merge with master

…num_channels_extra_dimension

* remotes/origin/hessio_instrument:
  Returned num_samples to inst. num_samples is filled with the telescopes that have data in the current event
  pyhessio: Renamed get_num_samples to get_event_num_samples to make it clearer that it will only supply the number of samples for telescopes which currently have data for the current event
  Moved num_samples to inside dl0
  Fill num_samples based on the telescopes that have data in current event (otherwise it will equal 0)
  Formatting of files to meet PEP8
  Changed filling of instrument container in hessio

# Conflicts:
#	ctapipe/io/containers.py
…sion' into camera_calibration_compenents

* remotes/origin/num_channels_extra_dimension:
  Returned num_samples to inst. num_samples is filled with the telescopes that have data in the current event

# Conflicts:
#	ctapipe/io/containers.py

Also fixed get_event_num_samples
…nents' into filereader

* remotes/origin/camera_calibration_compenents:
  Moved num_samples to the r0 container as it obtained on a per-event basis
  Returned num_samples to inst. num_samples is filled with the telescopes that have data in the current event
…libration_compenents

* remotes/upstream/master: (28 commits)
  add features back to the version.py which writes a version string to a file
  fix makefile to work without astropy_helpers
  rewritten the conf.py for sphinx from scratch. also added new autocreated make files
  add install with conda logo to readme
  remove  ez_setup. all python distros ship with setuptools afaik. also remove  unused files from manifest.
  Add numpydocs to sphinx extension and set the proper settings for it
  remove astropy references from docs as well
  add more docs to the version.py file
  fix documentation for `image.hillas`
  just use __version__ as a top level member after all. otherwise setup.py can't reallz import it due to having the same name as the python file
  also add the 'version' attribute to the toplevel module. some classes use that
  simplify setup.py and add a script to fetch the version string from git describe to create a version string compatible with PEP 440
  remove all things related to the astropy_helpers stuff.
  fixed reco docs and comments
  fix docstring formatting and change comments to comment char
  add correct units to angle in call ti np.sin
  remove execute bit
  get rid of relative import so test works independently
  renamed variable u and v  to uu,vv to avoid overwriting the units library import alias
  clean up Hillas routines and display
  ...
* camera_calibration_compenents: (29 commits)
  Updated required pyhessio version for travis
  add features back to the version.py which writes a version string to a file
  fix makefile to work without astropy_helpers
  rewritten the conf.py for sphinx from scratch. also added new autocreated make files
  add install with conda logo to readme
  remove  ez_setup. all python distros ship with setuptools afaik. also remove  unused files from manifest.
  Add numpydocs to sphinx extension and set the proper settings for it
  remove astropy references from docs as well
  add more docs to the version.py file
  fix documentation for `image.hillas`
  just use __version__ as a top level member after all. otherwise setup.py can't reallz import it due to having the same name as the python file
  also add the 'version' attribute to the toplevel module. some classes use that
  simplify setup.py and add a script to fetch the version string from git describe to create a version string compatible with PEP 440
  remove all things related to the astropy_helpers stuff.
  fixed reco docs and comments
  fix docstring formatting and change comments to comment char
  add correct units to angle in call ti np.sin
  remove execute bit
  get rid of relative import so test works independently
  renamed variable u and v  to uu,vv to avoid overwriting the units library import alias
  ...
@kosack kosack merged commit 8e21663 into cta-observatory:master Jan 12, 2017
@watsonjj watsonjj deleted the filereader branch January 13, 2017 14:43
kosack added a commit that referenced this pull request Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants