<commit_before>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example for calculating the fn-coefficients\n",
    "\n",
    "In the following, a simple example on how to manually evaluate the fn-coefficients is given. \n",
    "The ground is hereby defined as a Lambertian-surface and the covering layer is assumed to consist of Rayleigh-particles. Thus, we have: ($R_0$ hereby denotes the diffuse albedo of the surface)\n",
    "\n",
    "Within the following calculation, the symbols and functions are defined as presented in the Theory-chapter of the documentation.\n",
    "\n",
    "### Definition of the BRDF of the ground surface:\n",
    "\n",
    "- $BRDF(\\theta, \\phi, \\theta_{ex},\\phi_{ex}) = \\frac{R_0}{\\pi}$\n",
    "\n",
    "### Definition of the scattering phase-function of the covering layer:\n",
    "\n",
    "- $p(\\theta, \\phi, \\theta_{ex},\\phi_{ex}) = \\frac{3}{16\\pi} (1+\\cos(\\Theta)^2) \\quad$ with $\\mbox{}\\quad$ $\\cos(\\Theta) = \\cos(\\theta)\\cos(\\theta_{ex}) + \\sin(\\theta)\\sin(\\theta_{ex})\\cos(\\phi - \\phi_{ex})$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Manual Calculation of the fn-coefficients:\n",
    "\n",
    "$INT := \\int_0^{2\\pi} p(\\theta_0, \\phi_0, \\theta,\\phi) * BRDF(\\pi-\\theta, \\phi, \\theta_{ex},\\phi_{ex}) d\\phi $\n",
    "\n",
    "$\\phantom{INT} = \\frac{3 R_0}{16 \\pi^2} \\int\\limits_{0}^{2\\pi}  (1+[\\cos(\\theta_0)\\cos(\\theta) + \\sin(\\theta_0)\\sin(\\theta)\\cos(\\phi_0 - \\phi)]^2) d\\phi$\n",
    "\n",
    "$\\phantom{INT} = \\frac{3 R_0}{16 \\pi^2} \\int\\limits_0^{2\\pi} (1+ \\mu_0^2 \\mu^2 + 2 \\mu_0 \\mu \\sin(\\theta_0) \\sin(\\theta) \\cos(\\phi_0 - \\phi) + (1-\\mu_0)^2(1-\\mu)^2 \\cos(\\phi_0 - \\phi)^2 d\\phi$\n",
    "\n",
    "\n",
    "where the shorthand-notation $\\mu_x = \\cos(\\theta_x)$ has been introduced.\n",
    "The above integral can now easily be solved by noticing:\n",
    "\n",
    "$\\int\\limits_0^{2\\pi} \\cos(\\phi_0 - \\phi)^n d\\phi = \\left\\lbrace \\begin{matrix} 2 \\pi & \\textrm{for } n=0 \\\\ 0 & \\textrm{for } n=1 \\\\ \\pi  & \\textrm{for } n=2 \\end{matrix} \\right.$\n",
    "    \n",
    "Inserting the above solution and using some algebraic manipulations we therefore find:\n",
    "\n",
    "$INT = \\frac{3 R_0}{16\\pi} \\Big[ (3-\\mu_0^2) + (3 \\mu_0 -1) \\mu^2 \\Big] := \\sum\\limits_{n=0}^2 f_n ~ \\mu^n $\n",
    "\n",
    "$\\Rightarrow \\quad f_0 = \\frac{3 R_0}{16\\pi}(3-\\mu_0^2) \\qquad f_1 = 0 \\qquad f_2 = \\frac{3 R_0}{16\\pi}(3 \\mu_0 -1) \\qquad f_n = 0 ~ \\forall ~n>2\n",
    "$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Evaluation of the fn-coefficients using the RT1-module"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [<commit_msg>updated ipython notebook<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example for calculating the fn-coefficients\n",
    "\n",
    "In the following, a simple example on how to manually evaluate the fn-coefficients is given. \n",
    "The ground is hereby defined as a Lambertian-surface and the covering layer is assumed to consist of Rayleigh-particles. Thus, we have: ($R_0$ hereby denotes the diffuse albedo of the surface)\n",
    "\n",
    "Within the following calculation, the symbols and functions are defined as presented in the Theory-chapter of the documentation.\n",
    "\n",
    "### Definition of the BRDF of the ground surface:\n",
    "\n",
    "- $BRDF(\\theta, \\phi, \\theta_{ex},\\phi_{ex}) = \\frac{R_0}{\\pi}$\n",
    "\n",
    "### Definition of the scattering phase-function of the covering layer:\n",
    "\n",
    "- $p(\\theta, \\phi, \\theta_{ex},\\phi_{ex}) = \\frac{3}{16\\pi} (1+\\cos(\\Theta)^2) \\quad$ with $\\mbox{}\\quad$ $\\cos(\\Theta) = \\cos(\\theta)\\cos(\\theta_{ex}) + \\sin(\\theta)\\sin(\\theta_{ex})\\cos(\\phi - \\phi_{ex})$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Manual Calculation of the fn-coefficients:\n",
    "\n",
    "$INT := \\int_0^{2\\pi} p(\\theta_0, \\phi_0, \\theta,\\phi) * BRDF(\\pi-\\theta, \\phi, \\theta_{ex},\\phi_{ex}) d\\phi $\n",
    "\n",
    "$\\phantom{INT} = \\frac{3 R_0}{16 \\pi^2} \\int\\limits_{0}^{2\\pi}  (1+[\\cos(\\theta_0)\\cos(\\theta) + \\sin(\\theta_0)\\sin(\\theta)\\cos(\\phi_0 - \\phi)]^2) d\\phi$\n",
    "\n",
    "$\\phantom{INT} = \\frac{3 R_0}{16 \\pi^2} \\int\\limits_0^{2\\pi} (1+ \\mu_0^2 \\mu^2 + 2 \\mu_0 \\mu \\sin(\\theta_0) \\sin(\\theta) \\cos(\\phi_0 - \\phi) + (1-\\mu_0)^2(1-\\mu)^2 \\cos(\\phi_0 - \\phi)^2 d\\phi$\n",
    "\n",
    "\n",
    "where the shorthand-notation $\\mu_x = \\cos(\\theta_x)$ has been introduced.\n",
    "The above integral can now easily be solved by noticing:\n",
    "\n",
    "$\\int_0^{2\\pi} \\cos(\\phi_0 - \\phi)^n d\\phi = \\left\\lbrace \\begin{matrix} 2 \\pi & \\textrm{for } n=0 \\\\ 0 & \\textrm{for } n=1 \\\\ \\pi  & \\textrm{for } n=2 \\end{matrix} \\right.$\n",
    "    \n",
    "Inserting the above solution and using some algebraic manipulations we therefore find:\n",
    "\n",
    "$INT = \\frac{3 R_0}{16\\pi} \\Big[ (3-\\mu_0^2) + (3 \\mu_0 -1) \\mu^2 \\Big] := \\sum_{n=0}^2 f_n ~ \\mu^n $\n",
    "\n",
    "$\\Rightarrow \\quad f_0 = \\frac{3 R_0}{16\\pi}(3-\\mu_0^2) \\qquad f_1 = 0 \\qquad f_2 = \\frac{3 R_0}{16\\pi}(3 \\mu_0 -1) \\qquad f_n = 0 ~ \\forall ~n>2\n",
    "$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Evaluation of the fn-coefficients using the RT1-module"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
{'fraction_non_alphanumeric': 0.26320287130405057, 'fraction_numerical': 0.030080328149034354, 'mean_word_length': 2.357429718875502, 'pattern_counts': {'":': 32, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '943802', 'n_tokens_mistral': 2337, 'n_tokens_neox': 2257, 'n_words': 544}