Skip to content

Add catalog line numbers of rendered objects to 'simcatobj' #359

@thusharaprr

Description

@thusharaprr

Users who supply custom catalogs to romanisim usually want to know which sources from their catalog were rendered in the simulation for the particular detector they chose. Currently file.tree['romanisim']['simcatobj'] has some info about the rendered objects such as their pixel x, y positions. But the catalog line number of each rendered object would be very useful to have. I believe that this can be done in romanisim.image.simulate_counts_generic() by making the following change to the code there.

Existing code:

objinfo = np.zeros(
    len(objlist),
    dtype=[('x', 'f4'), ('y', 'f4'), ('counts', 'f4'), ('time', 'f4')])
if len(objlist) > 0:
    objinfo['x'][keep] = xpos[keep]
    objinfo['y'][keep] = ypos[keep]
    objinfo['counts'][keep] = objinfokeep['counts']
    objinfo['time'][keep] = objinfokeep['time']

Suggested code:

objinfo = np.zeros(
    len(objlist),
    dtype=[('index', 'i4'), ('x', 'f4'), ('y', 'f4'), ('counts', 'f4'), ('time', 'f4')])
if len(objlist) > 0:
    objinfo['index'][keep] = np.where(keep)[0]
    objinfo['x'][keep] = xpos[keep]
    objinfo['y'][keep] = ypos[keep]
    objinfo['counts'][keep] = objinfokeep['counts']
    objinfo['time'][keep] = objinfokeep['time']

Just one line has been edited and one line has been added. Can you please make this change in an upcoming version of romanisim? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions