# Cut-off dimension in Fock backend

Hi!
I just wanted some help regarding understanding the cut off dimension in the ‘fock’ backend. How can I determine what shoud be the minimum cut-off dimension for a given mean photon number?

If you start directly from a Fock state then you can just set the cutoff as n+1 where n is the number of photons in that mode. See for example the code below:

``````import numpy as np
from mrmustard.lab import Fock
state = Fock(4)
print('Mean photon number',state.number_means)
print('Sum of probabilities',np.sum(state.fock_probabilities(state.cutoffs), axis=0))
state
``````

Note that I’m using MrMustard, which is a useful library for generating graphs which can help you choose a good cutoff.

If you start with a thermal state you can’t really specify a minimum cut-off dimension for a given mean photon number because the spread around the mean might be large and you risk losing information.

In the code below for example I generate a thermal state with mean photon number of four. You can see that the distribution is so flat that even a cutoff of 31 is not enough to capture all of the information.

``````from mrmustard.lab import Thermal

state = Thermal(nbar=4, modes=1)
print('Mean photon number',state.number_means)
print('Sum of probabilities',np.sum(state.fock_probabilities(state.cutoffs), axis=0))
state
``````