Skip to content

Commit

Permalink
minor changes to the process
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenstarknight committed Jun 21, 2024
1 parent b22f2e3 commit 39ebf35
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 68 deletions.
74 changes: 11 additions & 63 deletions raytracer_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,21 @@
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_2197/3543466661.py:7: DeprecationWarning: This function is deprecated. See: https://pyproj4.github.io/pyproj/stable/gotchas.html#upgrading-to-pyproj-2-from-pyproj-1\n",
" lon_deg, lat_deg, alt_m = pyproj.transform(\n"
]
}
],
"outputs": [],
"source": [
"# Initial Starting Point\n",
"\n",
"from src.positional.locationconverter_computations import LocationConverterComputation\n",
"\n",
"\n",
"currentDateTime = datetime(2021, 1, 26, 12, 0, 0)\n",
"sat_ECEF = satPosGenerator.estimatePosition_ECEF(currentDateTime)\n",
"\n",
"# expected height, assume minimal change in position with range projection\n",
"lon_deg, lat_deg, alt_m = pyproj.transform(\n",
" ECEF, LLA, sat_ECEF.x_m, sat_ECEF.y_m, sat_ECEF.z_m, radians=False)\n",
"event_LLA: LLA_Coord = LocationConverterComputation.convertFromECEFtoLLA(ecef=sat_ECEF)\n",
"event_LLA.setAltitude(0.0)\n",
"\n",
"\n",
"event_LLA = LLA_Coord(lat_deg, lon_deg, 0.0)\n",
"timeAndLocation = TimeAndLocation(\n",
" eventLocation_LLA=event_LLA, eventTime_UTC=currentDateTime)"
]
Expand All @@ -80,61 +74,15 @@
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/workspaces/RayTracing/src/stratification/abstractquantizer.py:48: IntegrationWarning: The occurrence of roundoff error is detected, which prevents \n",
" the requested tolerance from being achieved. The error may be \n",
" underestimated.\n",
" areaY = integrate.quad(lambda x : self.funcInput(x), start, end)\n",
"\u001b[32m2023-06-29 01:05:56.749\u001b[0m | \u001b[31m\u001b[1mERROR \u001b[0m | \u001b[36msrc.raytracer.raytracer\u001b[0m:\u001b[36m_findNextIntersectPoint\u001b[0m:\u001b[36m285\u001b[0m - \u001b[31m\u001b[1m('No Intersection with Layer',)\u001b[0m\n"
]
},
{
"ename": "IntersectException",
"evalue": "how did we get here?",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mIntersectException\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer.py:267\u001b[0m, in \u001b[0;36mTransitionGenerator._findNextIntersectPoint\u001b[0;34m(self, currentState, ecef_p1, sVector_m)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m--> 267\u001b[0m ecef_p2 \u001b[39m=\u001b[39m RayTracerComputations\u001b[39m.\u001b[39;49mcomputeNewIntersection(\n\u001b[1;32m 268\u001b[0m ecef_m\u001b[39m=\u001b[39;49mecef_p1, sVector_m\u001b[39m=\u001b[39;49msVector_m, newAltitude_m\u001b[39m=\u001b[39;49mnewAltitude_m\n\u001b[1;32m 269\u001b[0m )\n\u001b[1;32m 270\u001b[0m \u001b[39mexcept\u001b[39;00m IntersectException \u001b[39mas\u001b[39;00m inst1:\n\u001b[1;32m 271\u001b[0m \u001b[39m# no intersection, which means (a) angle is down and (b) it is skipping over the lower layer; intersect with self\u001b[39;00m\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer_computations.py:107\u001b[0m, in \u001b[0;36mRayTracerComputations.computeNewIntersection\u001b[0;34m(ecef_m, sVector_m, newAltitude_m)\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m--> 107\u001b[0m \u001b[39mraise\u001b[39;00m IntersectException(\u001b[39m\"\u001b[39m\u001b[39mNo Intersection with Layer\u001b[39m\u001b[39m\"\u001b[39m)\n",
"\u001b[0;31mIntersectException\u001b[0m: No Intersection with Layer",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mIntersectException\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer.py:281\u001b[0m, in \u001b[0;36mTransitionGenerator._findNextIntersectPoint\u001b[0;34m(self, currentState, ecef_p1, sVector_m)\u001b[0m\n\u001b[1;32m 280\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m--> 281\u001b[0m ecef_p2 \u001b[39m=\u001b[39m RayTracerComputations\u001b[39m.\u001b[39;49mcomputeNewIntersection(\n\u001b[1;32m 282\u001b[0m ecef_m\u001b[39m=\u001b[39;49mecef_p1, sVector_m\u001b[39m=\u001b[39;49msVector_m, newAltitude_m\u001b[39m=\u001b[39;49mnewAltitude_m\n\u001b[1;32m 283\u001b[0m )\n\u001b[1;32m 284\u001b[0m \u001b[39mexcept\u001b[39;00m IntersectException \u001b[39mas\u001b[39;00m inst2:\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer_computations.py:107\u001b[0m, in \u001b[0;36mRayTracerComputations.computeNewIntersection\u001b[0;34m(ecef_m, sVector_m, newAltitude_m)\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m--> 107\u001b[0m \u001b[39mraise\u001b[39;00m IntersectException(\u001b[39m\"\u001b[39m\u001b[39mNo Intersection with Layer\u001b[39m\u001b[39m\"\u001b[39m)\n",
"\u001b[0;31mIntersectException\u001b[0m: No Intersection with Layer",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mIntersectException\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[4], line 11\u001b[0m\n\u001b[1;32m 7\u001b[0m freq_Hz \u001b[39m=\u001b[39m \u001b[39m1000\u001b[39m\u001b[39m*\u001b[39m\u001b[39m6\u001b[39m\n\u001b[1;32m 9\u001b[0m quantizationParameter \u001b[39m=\u001b[39m QuantizationParameter(StratificationMethod\u001b[39m.\u001b[39mDECIMATION_MODEL,nQuant\u001b[39m=\u001b[39m\u001b[39m10\u001b[39m)\n\u001b[0;32m---> 11\u001b[0m transIonosphereEffects \u001b[39m=\u001b[39m estimateRayPathEffects\u001b[39m.\u001b[39;49mestimate(freq_Hz\u001b[39m=\u001b[39;49mfreq_Hz, quantizationParameter\u001b[39m=\u001b[39;49mquantizationParameter, \n\u001b[1;32m 12\u001b[0m ionosphereState\u001b[39m=\u001b[39;49mionosphereState, satelliteInformation\u001b[39m=\u001b[39;49msatelliteInformation)\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raypatheffects.py:41\u001b[0m, in \u001b[0;36mEstimateRayPathEffects.estimate\u001b[0;34m(self, freq_Hz, quantizationParameter, satelliteInformation, ionosphereState)\u001b[0m\n\u001b[1;32m 35\u001b[0m \u001b[39m# ======================================================\u001b[39;00m\n\u001b[1;32m 36\u001b[0m \u001b[39m# Generate Ray State\u001b[39;00m\n\u001b[1;32m 37\u001b[0m optimizer \u001b[39m=\u001b[39m RayPathOptimizer(\n\u001b[1;32m 38\u001b[0m freq_hz\u001b[39m=\u001b[39mfreq_Hz, timeAndLocation\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mtimeAndLocation, heights_m\u001b[39m=\u001b[39mheights_m, dispersionModel\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdispersionModel,\n\u001b[1;32m 39\u001b[0m transportMode\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mtransportMode, ionosphereState\u001b[39m=\u001b[39mionosphereState)\n\u001b[0;32m---> 41\u001b[0m rayVectors: \u001b[39mlist\u001b[39m[RayVector] \u001b[39m=\u001b[39m optimizer\u001b[39m.\u001b[39;49moptimize(satelliteInformation\u001b[39m=\u001b[39;49msatelliteInformation)\n\u001b[1;32m 43\u001b[0m totalIonoLoss_db \u001b[39m=\u001b[39m \u001b[39m0\u001b[39m\n\u001b[1;32m 44\u001b[0m totalIonoDelay_sec \u001b[39m=\u001b[39m \u001b[39m0\u001b[39m\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raypathoptimizer.py:71\u001b[0m, in \u001b[0;36mRayPathOptimizer.optimize\u001b[0;34m(self, satelliteInformation)\u001b[0m\n\u001b[1;32m 69\u001b[0m bnds \u001b[39m=\u001b[39m ((\u001b[39mNone\u001b[39;00m, \u001b[39mNone\u001b[39;00m), (\u001b[39m-\u001b[39m\u001b[39m90\u001b[39m, \u001b[39m90\u001b[39m))\n\u001b[1;32m 70\u001b[0m \u001b[39m# tol to a meter\u001b[39;00m\n\u001b[0;32m---> 71\u001b[0m result \u001b[39m=\u001b[39m minimize(\n\u001b[1;32m 72\u001b[0m objectiveF\u001b[39m.\u001b[39;49mobjectiveFunction,\n\u001b[1;32m 73\u001b[0m x0\u001b[39m=\u001b[39;49minitialGuess,\n\u001b[1;32m 74\u001b[0m method\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39mNelder-Mead\u001b[39;49m\u001b[39m'\u001b[39;49m,\n\u001b[1;32m 75\u001b[0m bounds \u001b[39m=\u001b[39;49m bnds,\n\u001b[1;32m 76\u001b[0m tol \u001b[39m=\u001b[39;49m \u001b[39m1e-3\u001b[39;49m\n\u001b[1;32m 77\u001b[0m )\n\u001b[1;32m 79\u001b[0m \u001b[39m# =============================================================================\u001b[39;00m\n\u001b[1;32m 80\u001b[0m \u001b[39m# construct the atmospheric model\u001b[39;00m\n\u001b[1;32m 81\u001b[0m indexNs: \u001b[39mlist\u001b[39m[\u001b[39mcomplex\u001b[39m] \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mindexOfRefractionGenerator\u001b[39m.\u001b[39mestimateIndexN(\n\u001b[1;32m 82\u001b[0m heightStratification_m\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mheights_m, sat_ECEF\u001b[39m=\u001b[39msat_ECEF\n\u001b[1;32m 83\u001b[0m )\n",
"File \u001b[0;32m/workspaces/RayTracing/venv/lib/python3.10/site-packages/scipy/optimize/_minimize.py:669\u001b[0m, in \u001b[0;36mminimize\u001b[0;34m(fun, x0, args, method, jac, hess, hessp, bounds, constraints, tol, callback, options)\u001b[0m\n\u001b[1;32m 666\u001b[0m bounds \u001b[39m=\u001b[39m standardize_bounds(bounds, x0, meth)\n\u001b[1;32m 668\u001b[0m \u001b[39mif\u001b[39;00m meth \u001b[39m==\u001b[39m \u001b[39m'\u001b[39m\u001b[39mnelder-mead\u001b[39m\u001b[39m'\u001b[39m:\n\u001b[0;32m--> 669\u001b[0m res \u001b[39m=\u001b[39m _minimize_neldermead(fun, x0, args, callback, bounds\u001b[39m=\u001b[39;49mbounds,\n\u001b[1;32m 670\u001b[0m \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49moptions)\n\u001b[1;32m 671\u001b[0m \u001b[39melif\u001b[39;00m meth \u001b[39m==\u001b[39m \u001b[39m'\u001b[39m\u001b[39mpowell\u001b[39m\u001b[39m'\u001b[39m:\n\u001b[1;32m 672\u001b[0m res \u001b[39m=\u001b[39m _minimize_powell(fun, x0, args, callback, bounds, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39moptions)\n",
"File \u001b[0;32m/workspaces/RayTracing/venv/lib/python3.10/site-packages/scipy/optimize/_optimize.py:793\u001b[0m, in \u001b[0;36m_minimize_neldermead\u001b[0;34m(func, x0, args, callback, maxiter, maxfev, disp, return_all, initial_simplex, xatol, fatol, adaptive, bounds, **unknown_options)\u001b[0m\n\u001b[1;32m 791\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[1;32m 792\u001b[0m \u001b[39mfor\u001b[39;00m k \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(N \u001b[39m+\u001b[39m \u001b[39m1\u001b[39m):\n\u001b[0;32m--> 793\u001b[0m fsim[k] \u001b[39m=\u001b[39m func(sim[k])\n\u001b[1;32m 794\u001b[0m \u001b[39mexcept\u001b[39;00m _MaxFuncCallError:\n\u001b[1;32m 795\u001b[0m \u001b[39mpass\u001b[39;00m\n",
"File \u001b[0;32m/workspaces/RayTracing/venv/lib/python3.10/site-packages/scipy/optimize/_optimize.py:496\u001b[0m, in \u001b[0;36m_wrap_scalar_function_maxfun_validation.<locals>.function_wrapper\u001b[0;34m(x, *wrapper_args)\u001b[0m\n\u001b[1;32m 494\u001b[0m ncalls[\u001b[39m0\u001b[39m] \u001b[39m+\u001b[39m\u001b[39m=\u001b[39m \u001b[39m1\u001b[39m\n\u001b[1;32m 495\u001b[0m \u001b[39m# A copy of x is sent to the user function (gh13740)\u001b[39;00m\n\u001b[0;32m--> 496\u001b[0m fx \u001b[39m=\u001b[39m function(np\u001b[39m.\u001b[39;49mcopy(x), \u001b[39m*\u001b[39;49m(wrapper_args \u001b[39m+\u001b[39;49m args))\n\u001b[1;32m 497\u001b[0m \u001b[39m# Ideally, we'd like to a have a true scalar returned from f(x). For\u001b[39;00m\n\u001b[1;32m 498\u001b[0m \u001b[39m# backwards-compatibility, also allow np.array([1.3]),\u001b[39;00m\n\u001b[1;32m 499\u001b[0m \u001b[39m# np.array([[1.3]]) etc.\u001b[39;00m\n\u001b[1;32m 500\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m np\u001b[39m.\u001b[39misscalar(fx):\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raypathobjective.py:44\u001b[0m, in \u001b[0;36mRayPathObjective.objectiveFunction\u001b[0;34m(self, params)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mobjectiveFunction\u001b[39m(\u001b[39mself\u001b[39m, params: \u001b[39mlist\u001b[39m[\u001b[39mfloat\u001b[39m]) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m \u001b[39mfloat\u001b[39m:\n\u001b[1;32m 43\u001b[0m \u001b[39m# initial parameters\u001b[39;00m\n\u001b[0;32m---> 44\u001b[0m stateList: \u001b[39mlist\u001b[39m[RayVector] \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mrayTracer\u001b[39m.\u001b[39;49mexecute(params\u001b[39m=\u001b[39;49mparams)\n\u001b[1;32m 46\u001b[0m \u001b[39m# find last point in the ray\u001b[39;00m\n\u001b[1;32m 47\u001b[0m hypoSat_ECEF: ECEF_Coord \u001b[39m=\u001b[39m stateList[\u001b[39m-\u001b[39m\u001b[39m1\u001b[39m]\u001b[39m.\u001b[39mecef_p2\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer.py:62\u001b[0m, in \u001b[0;36mRayTracer.execute\u001b[0;34m(self, params)\u001b[0m\n\u001b[1;32m 59\u001b[0m rayVectors \u001b[39m=\u001b[39m []\n\u001b[1;32m 61\u001b[0m \u001b[39mfor\u001b[39;00m idx \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(\u001b[39m100\u001b[39m):\n\u001b[0;32m---> 62\u001b[0m rayVector : RayVector \u001b[39m=\u001b[39m transitionGenerator\u001b[39m.\u001b[39;49mtransition()\n\u001b[1;32m 63\u001b[0m \u001b[39mif\u001b[39;00m(rayVector \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m):\n\u001b[1;32m 64\u001b[0m rayVectors\u001b[39m.\u001b[39mappend(rayVector)\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer.py:91\u001b[0m, in \u001b[0;36mTransitionGenerator.transition\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 90\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mtransition\u001b[39m(\u001b[39mself\u001b[39m) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m Optional[RayVector]:\n\u001b[0;32m---> 91\u001b[0m transitionOutput : TransitionOutput \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49minsideLayerOperations(currentRayState\u001b[39m=\u001b[39;49m\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mcurrentState)\n\u001b[1;32m 93\u001b[0m \u001b[39mif\u001b[39;00m transitionOutput \u001b[39m==\u001b[39m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 94\u001b[0m \u001b[39m#logger.debug(\"Done with iterations, jump out of loop\")\u001b[39;00m\n\u001b[1;32m 95\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mNone\u001b[39;00m\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer.py:122\u001b[0m, in \u001b[0;36mTransitionGenerator.insideLayerOperations\u001b[0;34m(self, currentRayState)\u001b[0m\n\u001b[1;32m 116\u001b[0m ecef_p1, sVector_m \u001b[39m=\u001b[39m RayTracerComputations\u001b[39m.\u001b[39mgeneratePositionAndVector(\n\u001b[1;32m 117\u001b[0m currentState\u001b[39m=\u001b[39mcurrentRayState\n\u001b[1;32m 118\u001b[0m )\n\u001b[1;32m 120\u001b[0m \u001b[39m# ==========================================================================\u001b[39;00m\n\u001b[1;32m 121\u001b[0m \u001b[39m# use quadratic equation to determine intersection in ECEF of the next layer based prior intersection and vector\u001b[39;00m\n\u001b[0;32m--> 122\u001b[0m intersection \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_findNextIntersectPoint(\n\u001b[1;32m 123\u001b[0m currentState\u001b[39m=\u001b[39;49mcurrentRayState, ecef_p1\u001b[39m=\u001b[39;49mecef_p1, sVector_m\u001b[39m=\u001b[39;49msVector_m\n\u001b[1;32m 124\u001b[0m )\n\u001b[1;32m 126\u001b[0m \u001b[39mif\u001b[39;00m intersection \u001b[39m==\u001b[39m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 127\u001b[0m \u001b[39m# exiting the loop\u001b[39;00m\n\u001b[1;32m 128\u001b[0m logger\u001b[39m.\u001b[39mdebug(\u001b[39m\"\u001b[39m\u001b[39mExiting the atmosphere\u001b[39m\u001b[39m\"\u001b[39m)\n",
"File \u001b[0;32m/workspaces/RayTracing/src/raytracer/raytracer.py:286\u001b[0m, in \u001b[0;36mTransitionGenerator._findNextIntersectPoint\u001b[0;34m(self, currentState, ecef_p1, sVector_m)\u001b[0m\n\u001b[1;32m 284\u001b[0m \u001b[39mexcept\u001b[39;00m IntersectException \u001b[39mas\u001b[39;00m inst2:\n\u001b[1;32m 285\u001b[0m logger\u001b[39m.\u001b[39merror(inst2\u001b[39m.\u001b[39margs)\n\u001b[0;32m--> 286\u001b[0m \u001b[39mraise\u001b[39;00m IntersectException(\u001b[39m\"\u001b[39m\u001b[39mhow did we get here?\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 288\u001b[0m \u001b[39mreturn\u001b[39;00m IntersectionPoint(ecef_p2\u001b[39m=\u001b[39mecef_p2, newAltitude_m\u001b[39m=\u001b[39mnewAltitude_m, indx\u001b[39m=\u001b[39mindx)\n",
"\u001b[0;31mIntersectException\u001b[0m: how did we get here?"
]
}
],
"outputs": [],
"source": [
"\n",
"\n",
"\n",
"ionosphereState = IonosphereState(150.0, 150.0, 3.0)\n",
"ionosphereState = IonosphereState(10.0, 10.0, [3.0, 3.0, 3.0])\n",
"\n",
"# ======================================================\n",
"estimateRayPathEffects = EstimateRayPathEffects(\n",
" timeAndLocation=timeAndLocation, dispersionModel=DispersionModel.X_MODEL, transportMode=TransportMode.PLASMA_MODE)\n",
"\n",
"freq_Hz = 1000*6\n",
"freq_Hz = 10e6\n",
"\n",
"quantizationParameter = QuantizationParameter(StratificationMethod.DECIMATION_MODEL,nQuant=10)\n",
"\n",
Expand Down Expand Up @@ -198,7 +146,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"version": "3.10.13"
},
"orig_nbformat": 4
},
Expand Down
3 changes: 2 additions & 1 deletion src/indexrefractionmodels/xmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# THIRDPARTY module
from scipy import constants
import numpy as np
from loguru import logger

# FIRSTPARTY modules
Expand All @@ -19,7 +20,7 @@ def estimateIndexOfRefraction(self, layer: Layer) -> complex:
logger.error(str(me))

n_e = iriOutput.n_e
if n_e == -1:
if np.isnan(n_e):
nSq = 1.0
else:
angularFreq_sq = (2 * math.pi * self.frequency_hz) ** 2
Expand Down
2 changes: 1 addition & 1 deletion src/indexrefractionmodels/xymodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def estimateIndexOfRefraction(self, layer: Layer) -> complex:
layer=layer)
n_e = iriOutput.n_e

if (n_e == -1.0):
if np.isnan(n_e):
nSq = 1.0
else:
# Magnetic Field Given Current State
Expand Down
2 changes: 1 addition & 1 deletion src/indexrefractionmodels/xyzmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def estimateIndexOfRefraction(self, layer: Layer) -> complex:

n_e = iriOutput.n_e

if n_e == -1.0:
if np.isnan(n_e):
nSq = 1.0
else:
# Atmosphere Model
Expand Down
4 changes: 2 additions & 2 deletions src/raytracer/stratificationoptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

class StratificationOptimizer():

_exoAtmoHeights_m = np.array([0.467e4, 0.783e4, 1.100e4, 1.416e4, 1.733e4,
2.020e4, 2.050e4, 2.366e4, 2.680e4, 3.000e4])
_exoAtmoHeights_m = np.array([0.467e7, 0.783e7, 1.100e7, 1.416e7, 1.733e7,
2.020e7, 2.050e7, 2.366e7, 2.680e7, 3.000e7])

def __init__(self, timeAndLocation: TimeAndLocation, dispersionModel: DispersionModel, transportMode: TransportMode):
self.timeAndLocation = timeAndLocation
Expand Down
2 changes: 2 additions & 0 deletions unittests/indexrefractionmodels/test_xmodel_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@ def test_xModel(self):
indexN = xModel.estimateIndexOfRefraction(layer=layer)
indexNs.append(indexN)


print(*indexNs, sep='\n')
self.assertTrue(len(indexNs) == len(heights_m) - 1)

0 comments on commit 39ebf35

Please sign in to comment.