Flux density to flux The definition of flux and flux density is fairly straightforward. However, I'm musing over the practical usage of it. 

For one thing, if you observe a source through a filter, how would one go from the total observed energy/number of photons to the flux per unit wavelength? It's not a matter of simply dividing by the width of the filter -- a filter can have any exotic form of course.

So, how is this derived?
Related, given a $f_{\nu}$ in some filter, what would be the way to go to total flux within that filter?
If the normalised filter response function is $R_{\nu}$ then the measured  flux is
$$ F = \int f_{\nu} R_{\nu}\ d\nu  $$
The integration is done over the frequency range of the filter.

If you measure a flux through a filter then the process cannot be inverted exactly. However the average flux density can be found by dividing the total flux by the effective frequency range
$$\langle f_{\nu} \rangle = F/ \int R_{\nu} d\nu $$