Quantification of porosity in extensively nanoporous thin films in contact with gases and liquids