Documentation on modifying events table
See original GitHub issueSince it is not possible to rewrite Observation.events
, we should show some documentation on how to modify the events list.
- The minimal solution would be to provide a HowTo entry with maybe the following lines of code
import numpy as np
from gammapy.data import DataStore, Observation, EventList
datastore = DataStore.from_dir("$GAMMAPY_DATA/hess-dl3-dr1/")
obs = datastore.obs(23523)
# compute the phase separately, using, eg: PINT
phase = np.random.random(len(obs.events.table))
# attach the phase column to the events table
table = obs.events.table
table["PHASE"] = phase
events_new = EventList(table)
# create a new observation
irfs = {}
for _ in obs.available_irfs:
irfs[_]= getattr(obs,_)
obs_new = = Observation.create(pointing=obs.pointing_radec,
location=obs.observatory_earth_location,
obs_id=obs.obs_id,
tstart=obs.tstart,
tstop=obs.tstop,
irfs=irfs)
- We can modify
Observation.create()
or add aObservation.copy()
to simplify this. One of the problems with the above lines of code is that most of the information contained inobs.fixed_pointing_info.meta
is lost inobs_new
I can implement either. Preference @registerrier @maxnoe @adonath ?
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Editing events in the selection table—ArcGIS Pipeline ...
ArcGIS Event Editor allows you to edit event records individually or in bulk. ... feature class and the Destination table must be in...
Read more >[GA4] Modify and create events via the user interface
You can create and modify events in two ways: In code, using Google Tag Manager or APIs such as gtag.js or Firebase; In...
Read more >Create an events table - OSIsoft Documentation
In the Events pane, click Create Events Table to create an events table on the display. The table shows all the events listed...
Read more >Creating, updating, and deleting the event table views from ...
To edit an events table view · To remove a column from the event table view, click in the corresponding row. A gray...
Read more >Modifying Guild Events | Discord.Net Documentation
Name Type Description
ChannelId ulong? Gets or sets the channel id of the event.
string string Gets or sets the location of this event.
Name string...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
One point regarding pulsar phase: DL3 files are source agnotic and phase is a property of an assumed source. There could even be the case where you have two pulsars in the same FoV, which will probably be the case for CTA observations of the galactic plane?
So having a single phase column in dl3 event lists does not really match the data model. You’d need a phase column per assumed object.
Of course, in most current cases, there is only one.
But at least CTA will very probably not have phase information prefilled in DL3 files, since the only relevant information from CTA is the timestamp of the events and the rest has to come from external information about the assumed object(s)…
I think having a convenience method to load data from an observation into memory might be useful here. So either:
Observation.to_in_memory()
or similardata_store.obs(12346, in_memory=True)