icecube / event-generator

IceCube event generator
GNU General Public License v3.0
1 stars 2 forks source link

Simulation: Take into account noise (second network result) in time PDF #19

Open fschlueter opened 8 months ago

fschlueter commented 8 months ago

Probably no relevant for TeV to PeV events. The method sample_pulses does not take into account the (flat) time pdf of the noise expectation. In fact it only takes the time pdf of the first nested_result (if it exist). Hence when one would combine networks for a cascades and a track, this would go wrong as well.

fschlueter commented 8 months ago

The piece of code I am referring to is

       if self._prefix != '':

            # allow for max 1-depth of nested results for mixture model comp.
            if 'latent_var_scale' not in result_tensors:
                log_warn(
                    f'Using nested result tensors from \'{self._prefix[:-1]}\' model for time PDF. '
                    'This is potentially wrong, since this is not the complete time PDF! All models: '
                    f"{list(result_tensors['nested_results'].keys())}"
                )
                result_tensors = result_tensors['nested_results'][
                    self._prefix[:-1]]

        cum_scale = np.cumsum(
            result_tensors['latent_var_scale'].numpy(), axis=-1)

        latent_var_mu = result_tensors['latent_var_mu'].numpy()
        latent_var_sigma = result_tensors['latent_var_sigma'].numpy()
        latent_var_r = result_tensors['latent_var_r'].numpy()
mhuen commented 7 months ago

When utilizing models for simulation, one will probably want to use a non-nested model without noise component. But also for combining a track and a cascade model: you'll want to use models that are trained without a noise component. Then you'd combine the pure cascade and track models with a noise model. Otherwise one would double count the noise contribution. The above code seems like a quick and dirty hack to allow for testing of trained models with noise expectation. Perhaps this needs more robust checks and error handling