Skip to content

Seed fix based on position for Pujol noise cancellation for image simulations #796

Description

@fabianhervaspeters

When metacal adds a fixnoise image, it is useful for the differently sheared image branches that the same noise realization is used in image simulations. This helps cancel noise between the sheared branches. Here, “branches” refers to image branches, not metacal branches.
This is the approach I used in the previous iteration, and it would be useful to add it to a simulation-mode run so that sigma_m converges more quickly. At the moment, the noise is fixed only at the tile level.

seed = int(''.join(re.findall(r'\d+', self._file_number_string)))

The code below, which was written for the previous version, defines the seed from the sky position using a 3-arcsecond grid. This means that even if the sheared versions have different detection ordering, the added noise is attached to the position.

#This is for simulation and ensures the seed is fixed per object FHP
#The logic is that the seed is fixed in boxes in 3 arcsec so that  
#different detections receive the same seed, the +1 on the CCD is in case of exposure overlap.
ra,dec,ccd_n = coord_list[0]
box_x = np.floor((ra*3600) / 3)+(ccd_n+1)
box_y = np.floor((dec*3600) / 3)+(ccd_n+2)
unique_seed = box_x  + box_y
np.random.seed(int(unique_seed))

In the new version, the self._rng should now be fixed inside the object loop for that to work

for i_tile, obj_id in enumerate(tile_cat.obj_id):
.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions