Module diskchef.maps.radmcrt
Classes
class Cloud (velocity_min: astropy.units.quantity.Quantity, velocity_max: astropy.units.quantity.Quantity)-
Tuple to store the foreground and background to mark on channel maps. Used in RadMCOutput
Expand source code
class Cloud(NamedTuple): """Tuple to store the foreground and background to mark on channel maps. Used in RadMCOutput""" velocity_min: u.Quantity velocity_max: u.QuantityAncestors
- builtins.tuple
Instance variables
var velocity_max : astropy.units.quantity.Quantity-
Alias for field number 1
var velocity_min : astropy.units.quantity.Quantity-
Alias for field number 0
class RadMCBase (chemistry: Union[ChemistryBase, PhysicsBase] = None, line_list: List[Line] = None, executable: Union[str, os.PathLike] = 'radmc3d', folder: Union[str, os.PathLike] = 'radmc', radii_bins: Optional[None] = None, theta_bins: Optional[None] = None, phi_bins: Optional[None] = None, outer_radius: Optional[None] = None, verbosity: int = 0, wavelengths: astropy.units.quantity.Quantity = <Quantity [9.13000000e-02, 9.23666837e-02, 9.34458298e-02, 9.45375839e-02, 9.56420933e-02, 9.67595069e-02, 9.78899756e-02, 9.90336519e-02, 1.00190690e-01, 1.01361246e-01, 1.02545478e-01, 1.03743546e-01, 1.04955611e-01, 1.06181838e-01, 1.07422390e-01, 1.08677436e-01, 1.09947145e-01, 1.11231689e-01, 1.12531240e-01, 1.13845975e-01, 1.15176069e-01, 1.16521704e-01, 1.17883060e-01, 1.19260321e-01, 1.20653673e-01, 1.22063304e-01, 1.23489404e-01, 1.24932166e-01, 1.26391784e-01, 1.27868455e-01, 1.29362378e-01, 1.30873756e-01, 1.32402791e-01, 1.33949690e-01, 1.35514662e-01, 1.37097918e-01, 1.38699672e-01, 1.40320140e-01, 1.41959539e-01, 1.43618093e-01, 1.45296024e-01, 1.46993558e-01, 1.48710926e-01, 1.50448358e-01, 1.52206088e-01, 1.53984355e-01, 1.55783398e-01, 1.57603459e-01, 1.59444785e-01, 1.61307624e-01, 1.63192226e-01, 1.65098847e-01, 1.67027744e-01, 1.68979176e-01, 1.70953408e-01, 1.72950705e-01, 1.74971337e-01, 1.77015577e-01, 1.79083700e-01, 1.81175985e-01, 1.83292715e-01, 1.85434176e-01, 1.87600656e-01, 1.89792448e-01, 1.92009847e-01, 1.94253152e-01, 1.96522666e-01, 1.98818696e-01, 2.01141551e-01, 2.03491545e-01, 2.05868994e-01, 2.08274220e-01, 2.10707547e-01, 2.13169303e-01, 2.15659820e-01, 2.18179435e-01, 2.20728487e-01, 2.23307320e-01, 2.25916283e-01, 2.28555727e-01, 2.31226008e-01, 2.33927487e-01, 2.36660528e-01, 2.39425500e-01, 2.42222776e-01, 2.45052733e-01, 2.47915753e-01, 2.50812223e-01, 2.53742533e-01, 2.56707079e-01, 2.59706261e-01, 2.62740482e-01, 2.65810154e-01, 2.68915689e-01, 2.72057507e-01, 2.75236032e-01, 2.78451692e-01, 2.81704922e-01, 2.84996161e-01, 2.88325852e-01, 2.91694444e-01, 2.95102393e-01, 2.98550158e-01, 3.02038204e-01, 3.05567001e-01, 3.09137027e-01, 3.12748763e-01, 3.16402695e-01, 3.20099317e-01, 3.23839128e-01, 3.27622632e-01, 3.31450340e-01, 3.35322768e-01, 3.39240439e-01, 3.43203881e-01, 3.47213629e-01, 3.51270224e-01, 3.55374214e-01, 3.59526151e-01, 3.63726597e-01, 3.67976118e-01, 3.72275287e-01, 3.76624684e-01, 3.81024897e-01, 3.85476519e-01, 3.89980150e-01, 3.94536399e-01, 3.99145879e-01, 4.03809213e-01, 4.08527031e-01, 4.13299967e-01, 4.18128668e-01, 4.23013783e-01, 4.27955973e-01, 4.32955904e-01, 4.38014250e-01, 4.43131695e-01, 4.48308928e-01, 4.53546648e-01, 4.58845562e-01, 4.64206384e-01, 4.69629839e-01, 4.75116657e-01, 4.80667579e-01, 4.86283355e-01, 4.91964741e-01, 4.97712504e-01, 5.03527420e-01, 5.09410274e-01, 5.15361858e-01, 5.21382976e-01, 5.27474441e-01, 5.33637074e-01, 5.39871707e-01, 5.46179181e-01, 5.52560347e-01, 5.59016066e-01, 5.65547209e-01, 5.72154657e-01, 5.78839302e-01, 5.85602045e-01, 5.92443800e-01, 5.99365488e-01, 6.06368045e-01, 6.13452414e-01, 6.20619553e-01, 6.27870426e-01, 6.35206014e-01, 6.42627306e-01, 6.50135303e-01, 6.57731017e-01, 6.65415475e-01, 6.73189712e-01, 6.81054778e-01, 6.89011734e-01, 6.97061653e-01, 7.05205622e-01, 7.13444738e-01, 7.21780115e-01, 7.30212877e-01, 7.38744160e-01, 7.47375117e-01, 7.56106912e-01, 7.64940723e-01, 7.73877742e-01, 7.82919175e-01, 7.92066241e-01, 8.01320175e-01, 8.10682226e-01, 8.20153656e-01, 8.29735743e-01, 8.39429780e-01, 8.49237076e-01, 8.59158953e-01, 8.69196750e-01, 8.79351822e-01, 8.89625538e-01, 9.00019285e-01, 9.10534465e-01, 9.21172497e-01, 9.31934816e-01, 9.42822874e-01, 9.53838141e-01, 9.64982102e-01, 9.76256261e-01, 9.87662139e-01, 9.99201275e-01, 1.01087523e+00, 1.02268557e+00, 1.03463389e+00, 1.04672181e+00, 1.05895096e+00, 1.07132298e+00, 1.08383955e+00, 1.09650236e+00, 1.10931311e+00, 1.12227352e+00, 1.13538536e+00, 1.14865039e+00, 1.16207040e+00, 1.17564720e+00, 1.18938262e+00, 1.20327851e+00, 1.21733675e+00, 1.23155924e+00, 1.24594790e+00, 1.26050466e+00, 1.27523149e+00, 1.29013038e+00, 1.30520334e+00, 1.32045240e+00, 1.33587962e+00, 1.35148708e+00, 1.36727689e+00, 1.38325117e+00, 1.39941208e+00, 1.41576181e+00, 1.43230256e+00, 1.44903655e+00, 1.46596606e+00, 1.48309335e+00, 1.50042075e+00, 1.51795059e+00, 1.53568524e+00, 1.55362708e+00, 1.57177855e+00, 1.59014208e+00, 1.60872016e+00, 1.62751530e+00, 1.64653002e+00, 1.66576689e+00, 1.68522852e+00, 1.70491752e+00, 1.72483656e+00, 1.74498831e+00, 1.76537550e+00, 1.78600088e+00, 1.80686724e+00, 1.82797738e+00, 1.84933416e+00, 1.87094045e+00, 1.89279918e+00, 1.91491329e+00, 1.93728576e+00, 1.95991962e+00, 1.98281791e+00, 2.00598374e+00, 2.02942021e+00, 2.05313050e+00, 2.07711781e+00, 2.10138536e+00, 2.12593644e+00, 2.15077436e+00, 2.17590246e+00, 2.20132415e+00, 2.22704284e+00, 2.25306201e+00, 2.27938517e+00, 2.30601588e+00, 2.33295771e+00, 2.36021432e+00, 2.38778937e+00, 2.41568659e+00, 2.44390974e+00, 2.47246263e+00, 2.50134911e+00, 2.53057308e+00, 2.56013848e+00, 2.59004930e+00, 2.62030958e+00, 2.65092340e+00, 2.68189489e+00, 2.71322822e+00, 2.74492764e+00, 2.77699740e+00, 2.80944185e+00, 2.84226535e+00, 2.87547234e+00, 2.90906730e+00, 2.94305476e+00, 2.97743930e+00, 3.01222557e+00, 3.04741825e+00, 3.08302210e+00, 3.11904192e+00, 3.15548257e+00, 3.19234896e+00, 3.22964608e+00, 3.26737895e+00, 3.30555266e+00, 3.34417237e+00, 3.38324328e+00, 3.42277067e+00, 3.46275987e+00, 3.50321627e+00, 3.54414534e+00, 3.58555259e+00, 3.62744362e+00, 3.66982407e+00, 3.71269966e+00, 3.75607618e+00, 3.79995948e+00, 3.84435549e+00, 3.88927018e+00, 3.93470962e+00, 3.98067995e+00, 4.02718736e+00, 4.07423813e+00, 4.12183861e+00, 4.16999521e+00, 4.21871445e+00, 4.26800288e+00, 4.31786717e+00, 4.36831403e+00, 4.41935028e+00, 4.47098280e+00, 4.52321856e+00, 4.57606460e+00, 4.62952806e+00, 4.68361615e+00, 4.73833616e+00, 4.79369548e+00, 4.84970158e+00, 4.90636202e+00, 4.96368443e+00, 5.02167656e+00, 5.08034623e+00, 5.13970136e+00, 5.19974994e+00, 5.26050009e+00, 5.32196000e+00, 5.38413797e+00, 5.44704237e+00, 5.51068171e+00, 5.57506457e+00, 5.64019962e+00, 5.70609567e+00, 5.77276160e+00, 5.84020641e+00, 5.90843919e+00, 5.97746916e+00, 6.04730562e+00, 6.11795801e+00, 6.18943584e+00, 6.26174877e+00, 6.33490656e+00, 6.40891906e+00, 6.48379628e+00, 6.55954830e+00, 6.63618536e+00, 6.71371780e+00, 6.79215606e+00, 6.87151074e+00, 6.95179255e+00, 7.03301231e+00, 7.11518098e+00, 7.19830965e+00, 7.28240954e+00, 7.36749199e+00, 7.45356849e+00, 7.54065064e+00, 7.62875019e+00, 7.71787904e+00, 7.80804920e+00, 7.89927285e+00, 7.99156229e+00, 8.08492998e+00, 8.17938850e+00, 8.27495061e+00, 8.37162920e+00, 8.46943732e+00, 8.56838815e+00, 8.66849505e+00, 8.76977153e+00, 8.87223126e+00, 8.97588805e+00, 9.08075589e+00, 9.18684893e+00, 9.29418148e+00, 9.40276803e+00, 9.51262323e+00, 9.62376190e+00, 9.73619904e+00, 9.84994981e+00, 9.96502956e+00, 1.00814538e+01, 1.01992383e+01, 1.03183989e+01, 1.04389517e+01, 1.05609129e+01, 1.06842990e+01, 1.08091267e+01, 1.09354128e+01, 1.10631743e+01, 1.11924285e+01, 1.13231928e+01, 1.14554849e+01, 1.15893226e+01, 1.17247239e+01, 1.18617072e+01, 1.20002908e+01, 1.21404936e+01, 1.22823345e+01, 1.24258325e+01, 1.25710070e+01, 1.27178776e+01, 1.28664642e+01, 1.30167867e+01, 1.31688655e+01, 1.33227211e+01, 1.34783742e+01, 1.36358459e+01, 1.37951573e+01, 1.39563300e+01, 1.41193858e+01, 1.42843466e+01, 1.44512346e+01, 1.46200725e+01, 1.47908830e+01, 1.49636890e+01, 1.51385140e+01, 1.53153816e+01, 1.54943155e+01, 1.56753400e+01, 1.58584794e+01, 1.60437585e+01, 1.62312023e+01, 1.64208360e+01, 1.66126853e+01, 1.68067760e+01, 1.70031343e+01, 1.72017868e+01, 1.74027601e+01, 1.76060815e+01, 1.78117783e+01, 1.80198784e+01, 1.82304097e+01, 1.84434007e+01, 1.86588802e+01, 1.88768772e+01, 1.90974211e+01, 1.93205416e+01, 1.95462690e+01, 1.97746336e+01, 2.00056662e+01, 2.02393981e+01, 2.04758607e+01, 2.07150860e+01, 2.09571062e+01, 2.12019540e+01, 2.14496624e+01, 2.17002649e+01, 2.19537952e+01, 2.22102876e+01, 2.24697767e+01, 2.27322975e+01, 2.29978853e+01, 2.32665762e+01, 2.35384061e+01, 2.38134120e+01, 2.40916308e+01, 2.43731002e+01, 2.46578580e+01, 2.49459427e+01, 2.52373932e+01, 2.55322489e+01, 2.58305493e+01, 2.61323350e+01, 2.64376464e+01, 2.67465249e+01, 2.70590122e+01, 2.73751502e+01, 2.76949819e+01, 2.80185502e+01, 2.83458988e+01, 2.86770720e+01, 2.90121143e+01, 2.93510711e+01, 2.96939880e+01, 3.00409112e+01, 3.03918877e+01, 3.07469647e+01, 3.11061902e+01, 3.14696126e+01, 3.18372810e+01, 3.22092450e+01, 3.25855547e+01, 3.29662610e+01, 3.33514151e+01, 3.37410691e+01, 3.41352756e+01, 3.45340877e+01, 3.49375592e+01, 3.53457446e+01, 3.57586989e+01, 3.61764779e+01, 3.65991380e+01, 3.70267361e+01, 3.74593299e+01, 3.78969778e+01, 3.83397390e+01, 3.87876730e+01, 3.92408403e+01, 3.96993022e+01, 4.01631204e+01, 4.06323575e+01, 4.11070768e+01, 4.15873424e+01, 4.20732191e+01, 4.25647724e+01, 4.30620687e+01, 4.35651750e+01, 4.40741593e+01, 4.45890902e+01, 4.51100371e+01, 4.56370705e+01, 4.61702613e+01, 4.67096815e+01, 4.72554039e+01, 4.78075022e+01, 4.83660508e+01, 4.89311250e+01, 4.95028012e+01, 5.00811565e+01, 5.06662688e+01, 5.12582171e+01, 5.18570814e+01, 5.24629424e+01, 5.30758818e+01, 5.36959823e+01, 5.43233277e+01, 5.49580025e+01, 5.56000924e+01, 5.62496840e+01, 5.69068650e+01, 5.75717240e+01, 5.82443507e+01, 5.89248359e+01, 5.96132715e+01, 6.03097502e+01, 6.10143661e+01, 6.17272142e+01, 6.24483907e+01, 6.31779929e+01, 6.39161193e+01, 6.46628694e+01, 6.54183440e+01, 6.61826450e+01, 6.69558756e+01, 6.77381400e+01, 6.85295439e+01, 6.93301940e+01, 7.01401982e+01, 7.09596660e+01, 7.17887079e+01, 7.26274357e+01, 7.34759626e+01, 7.43344030e+01, 7.52028729e+01, 7.60814893e+01, 7.69703709e+01, 7.78696375e+01, 7.87794105e+01, 7.96998127e+01, 8.06309682e+01, 8.15730026e+01, 8.25260431e+01, 8.34902182e+01, 8.44656580e+01, 8.54524942e+01, 8.64508599e+01, 8.74608897e+01, 8.84827201e+01, 8.95164887e+01, 9.05623352e+01, 9.16204006e+01, 9.26908277e+01, 9.37737608e+01, 9.48693462e+01, 9.59777316e+01, 9.70990666e+01, 9.82335025e+01, 9.93811923e+01, 1.00542291e+02, 1.01716955e+02, 1.02905343e+02, 1.04107615e+02, 1.05323934e+02, 1.06554463e+02, 1.07799369e+02, 1.09058820e+02, 1.10332985e+02, 1.11622036e+02, 1.12926148e+02, 1.14245496e+02, 1.15580259e+02, 1.16930616e+02, 1.18296749e+02, 1.19678843e+02, 1.21077085e+02, 1.22491663e+02, 1.23922768e+02, 1.25370593e+02, 1.26835333e+02, 1.28317186e+02, 1.29816352e+02, 1.31333033e+02, 1.32867434e+02, 1.34419762e+02, 1.35990226e+02, 1.37579038e+02, 1.39186413e+02, 1.40812567e+02, 1.42457720e+02, 1.44122094e+02, 1.45805913e+02, 1.47509405e+02, 1.49232799e+02, 1.50976328e+02, 1.52740228e+02, 1.54524735e+02, 1.56330091e+02, 1.58156540e+02, 1.60004327e+02, 1.61873703e+02, 1.63764920e+02, 1.65678231e+02, 1.67613897e+02, 1.69572178e+02, 1.71553337e+02, 1.73557644e+02, 1.75585367e+02, 1.77636780e+02, 1.79712161e+02, 1.81811789e+02, 1.83935948e+02, 1.86084923e+02, 1.88259006e+02, 1.90458489e+02, 1.92683670e+02, 1.94934848e+02, 1.97212327e+02, 1.99516414e+02, 2.01847421e+02, 2.04205661e+02, 2.06591454e+02, 2.09005120e+02, 2.11446986e+02, 2.13917381e+02, 2.16416639e+02, 2.18945095e+02, 2.21503093e+02, 2.24090976e+02, 2.26709095e+02, 2.29357801e+02, 2.32037453e+02, 2.34748412e+02, 2.37491045e+02, 2.40265720e+02, 2.43072812e+02, 2.45912700e+02, 2.48785768e+02, 2.51692403e+02, 2.54632996e+02, 2.57607946e+02, 2.60617652e+02, 2.63662522e+02, 2.66742966e+02, 2.69859399e+02, 2.73012243e+02, 2.76201922e+02, 2.79428868e+02, 2.82693514e+02, 2.85996302e+02, 2.89337678e+02, 2.92718092e+02, 2.96138000e+02, 2.99597865e+02, 3.03098151e+02, 3.06639333e+02, 3.10221887e+02, 3.13846297e+02, 3.17513052e+02, 3.21222647e+02, 3.24975582e+02, 3.28772364e+02, 3.32613504e+02, 3.36499522e+02, 3.40430941e+02, 3.44408292e+02, 3.48432112e+02, 3.52502943e+02, 3.56621334e+02, 3.60787842e+02, 3.65003029e+02, 3.69267462e+02, 3.73581719e+02, 3.77946380e+02, 3.82362034e+02, 3.86829278e+02, 3.91348714e+02, 3.95920952e+02, 4.00546608e+02, 4.05226308e+02, 4.09960681e+02, 4.14750368e+02, 4.19596014e+02, 4.24498273e+02, 4.29457806e+02, 4.34475283e+02, 4.39551381e+02, 4.44686784e+02, 4.49882186e+02, 4.55138287e+02, 4.60455796e+02, 4.65835431e+02, 4.71277919e+02, 4.76783992e+02, 4.82354394e+02, 4.87989877e+02, 4.93691201e+02, 4.99459135e+02, 5.05294457e+02, 5.11197955e+02, 5.17170426e+02, 5.23212674e+02, 5.29325516e+02, 5.35509776e+02, 5.41766288e+02, 5.48095897e+02, 5.54499456e+02, 5.60977830e+02, 5.67531893e+02, 5.74162529e+02, 5.80870632e+02, 5.87657108e+02, 5.94522873e+02, 6.01468852e+02, 6.08495982e+02, 6.15605213e+02, 6.22797503e+02, 6.30073823e+02, 6.37435153e+02, 6.44882489e+02, 6.52416833e+02, 6.60039204e+02, 6.67750629e+02, 6.75552148e+02, 6.83444815e+02, 6.91429694e+02, 6.99507863e+02, 7.07680411e+02, 7.15948442e+02, 7.24313070e+02, 7.32775425e+02, 7.41336647e+02, 7.49997893e+02, 7.58760331e+02, 7.67625143e+02, 7.76593524e+02, 7.85666686e+02, 7.94845852e+02, 8.04132262e+02, 8.13527166e+02, 8.23031834e+02, 8.32647548e+02, 8.42375605e+02, 8.52217318e+02, 8.62174014e+02, 8.72247037e+02, 8.82437746e+02, 8.92747516e+02, 9.03177738e+02, 9.13729819e+02, 9.24405183e+02, 9.35205270e+02, 9.46131538e+02, 9.57185461e+02, 9.68368529e+02, 9.79682253e+02, 9.91128158e+02, 1.00270779e+03, 1.01442271e+03, 1.02627449e+03, 1.03826475e+03, 1.05039509e+03, 1.06266715e+03, 1.07508260e+03, 1.08764309e+03, 1.10035033e+03, 1.11320604e+03, 1.12621194e+03, 1.13936979e+03, 1.15268137e+03, 1.16614847e+03, 1.17977291e+03, 1.19355654e+03, 1.20750119e+03, 1.22160877e+03, 1.23588117e+03, 1.25032032e+03, 1.26492817e+03, 1.27970668e+03, 1.29465786e+03, 1.30978371e+03, 1.32508629e+03, 1.34056764e+03, 1.35622988e+03, 1.37207509e+03, 1.38810543e+03, 1.40432306e+03, 1.42073017e+03, 1.43732896e+03, 1.45412168e+03, 1.47111060e+03, 1.48829800e+03, 1.50568620e+03, 1.52327756e+03, 1.54107445e+03, 1.55907925e+03, 1.57729442e+03, 1.59572240e+03, 1.61436567e+03, 1.63322676e+03, 1.65230821e+03, 1.67161260e+03, 1.69114252e+03, 1.71090062e+03, 1.73088955e+03, 1.75111203e+03, 1.77157076e+03, 1.79226853e+03, 1.81320811e+03, 1.83439233e+03, 1.85582405e+03, 1.87750617e+03, 1.89944161e+03, 1.92163332e+03, 1.94408431e+03, 1.96679759e+03, 1.98977625e+03, 2.01302337e+03, 2.03654209e+03, 2.06033559e+03, 2.08440707e+03, 2.10875979e+03, 2.13339702e+03, 2.15832211e+03, 2.18353839e+03, 2.20904929e+03, 2.23485824e+03, 2.26096872e+03, 2.28738426e+03, 2.31410842e+03, 2.34114480e+03, 2.36849706e+03, 2.39616888e+03, 2.42416400e+03, 2.45248619e+03, 2.48113928e+03, 2.51012713e+03, 2.53945366e+03, 2.56912281e+03, 2.59913860e+03, 2.62950508e+03, 2.66022633e+03, 2.69130650e+03, 2.72274980e+03, 2.75456046e+03, 2.78674277e+03, 2.81930107e+03, 2.85223976e+03, 2.88556329e+03, 2.91927614e+03, 2.95338287e+03, 2.98788808e+03, 3.02279642e+03, 3.05811260e+03, 3.09384140e+03, 3.12998762e+03, 3.16655616e+03, 3.20355193e+03, 3.24097993e+03, 3.27884522e+03, 3.31715289e+03, 3.35590813e+03, 3.39511615e+03, 3.43478226e+03, 3.47491179e+03, 3.51551017e+03, 3.55658287e+03, 3.59813543e+03, 3.64017347e+03, 3.68270264e+03, 3.72572870e+03, 3.76925744e+03, 3.81329474e+03, 3.85784655e+03, 3.90291886e+03, 3.94851776e+03, 3.99464942e+03, 4.04132003e+03, 4.08853592e+03, 4.13630344e+03, 4.18462905e+03, 4.23351925e+03, 4.28298066e+03, 4.33301993e+03, 4.38364383e+03, 4.43485918e+03, 4.48667290e+03, 4.53909196e+03, 4.59212346e+03, 4.64577454e+03, 4.70005244e+03, 4.75496448e+03, 4.81051808e+03, 4.86672072e+03, 4.92357999e+03, 4.98110357e+03, 5.03929922e+03, 5.09817477e+03, 5.15773819e+03, 5.21799751e+03, 5.27896085e+03, 5.34063644e+03, 5.40303261e+03, 5.46615777e+03, 5.53002044e+03, 5.59462923e+03, 5.65999287e+03, 5.72612017e+03, 5.79302005e+03, 5.86070154e+03, 5.92917378e+03, 5.99844599e+03, 6.06852753e+03, 6.13942786e+03, 6.21115653e+03, 6.28372323e+03, 6.35713775e+03, 6.43140999e+03, 6.50654997e+03, 6.58256784e+03, 6.65947384e+03, 6.73727836e+03, 6.81599189e+03, 6.89562505e+03, 6.97618859e+03, 7.05769337e+03, 7.14015040e+03, 7.22357080e+03, 7.30796582e+03, 7.39334685e+03, 7.47972542e+03, 7.56711317e+03, 7.65552189e+03, 7.74496352e+03, 7.83545012e+03, 7.92699390e+03, 8.01960721e+03, 8.11330256e+03, 8.20809257e+03, 8.30399003e+03, 8.40100790e+03, 8.49915925e+03, 8.59845733e+03, 8.69891555e+03, 8.80054744e+03, 8.90336672e+03, 9.00738728e+03, 9.11262313e+03, 9.21908849e+03, 9.32679771e+03, 9.43576532e+03, 9.54600604e+03, 9.65753473e+03, 9.77036644e+03, 9.88451640e+03, 1.00000000e+04] um>, modified_random_walk: bool = True, scattering_mode_max: int = None, istar_sphere: int = None, nphot_therm: int = None, nphotdiff: float = None, nphotdiff_type: int = None, nphot_mono: int = None, nphot_spec: int = None, mc_scat_maxtauabs: float = None, nphot_scat: int = None, coordinate: Union[str, astropy.coordinates.sky_coordinate.SkyCoord] = None, external_source_type: Literal['Draine1978', 'WeingartnerDraine2001', 'None'] = None, external_source_multiplier: float = 1)-
RadMCBase(chemistry: Union[diskchef.chemistry.base.ChemistryBase, diskchef.physics.base.PhysicsBase] = None, line_list: List[diskchef.lamda.line.Line] = None, executable: Union[str, os.PathLike] = 'radmc3d', folder: Union[str, os.PathLike] = 'radmc', radii_bins: Union[NoneType, int] = None, theta_bins: Union[NoneType, int] = None, phi_bins: Union[NoneType, int] = None, outer_radius: Union[NoneType, astropy.units.quantity.Quantity] = None, verbosity: int = 0, wavelengths: astropy.units.quantity.Quantity =
, modified_random_walk: bool = True, scattering_mode_max: int = None, istar_sphere: int = None, nphot_therm: int = None, nphotdiff: float = None, nphotdiff_type: int = None, nphot_mono: int = None, nphot_spec: int = None, mc_scat_maxtauabs: float = None, nphot_scat: int = None, coordinate: Union[str, astropy.coordinates.sky_coordinate.SkyCoord] = None, external_source_type: Literal['Draine1978', 'WeingartnerDraine2001', 'None'] = None, external_source_multiplier: float = 1) Expand source code
class RadMCBase(MapBase): executable: PathLike = RADMC_DEFAULT_EXEC folder: PathLike = 'radmc' radii_bins: Union[None, int] = None theta_bins: Union[None, int] = None phi_bins: Union[None, int] = None outer_radius: Union[None, u.Quantity] = None verbosity: int = 0 wavelengths: u.Quantity = field(default=np.geomspace(0.0913, 10000, 1000) * u.um) modified_random_walk: bool = True scattering_mode_max: int = None istar_sphere: int = None nphot_therm: int = None nphotdiff: float = None nphotdiff_type: int = None nphot_mono: int = None nphot_spec: int = None mc_scat_maxtauabs: float = None nphot_scat: int = None coordinate: Union[str, SkyCoord] = None external_source_type: Literal["Draine1978", "WeingartnerDraine2001", "None"] = None external_source_multiplier: float = 1 def __post_init__(self): super().__post_init__() if not (self.table.is_in_zr_regular_grid or self.table.is_in_z_regular_grid): self.logger.warn("Grid isn't cartesian in cylindrical/spherical, will regrid but result may be weird.") try: Path(self.folder).mkdir(parents=True, exist_ok=True) except FileExistsError: # self.logger.warn("Directory %s already exists! The results can be biased.", self.folder) pass if self.table.coord_base == 'cylinder': if self.radii_bins is None: radii = u.Quantity(self.table.r_grid).to(u.cm) if self.outer_radius is not None: radii = radii[radii <= self.outer_radius] self._check_outer_radius() elif isinstance(self.radii_bins, int): if self.outer_radius is None: outer_radius = self.table.r.max() else: outer_radius = self.outer_radius self._check_outer_radius() radii = np.geomspace(self.table.r.min(), outer_radius, self.radii_bins).to(u.cm) else: raise CHEFTypeError("radii_bins should be None or int, not %s (%s)", type(self.radii_bins), self.radii_bins) zr = u.Quantity(self.table.zr_grid) theta = np.pi / 2 * u.rad - np.arctan(zr) if self.theta_bins is None: theta = u.Quantity(np.sort(np.unique(theta))) if not self.table.is_in_zr_regular_grid: if self.table.is_in_z_regular_grid: theta = np.linspace(np.min(theta), np.max(theta), len(self.table.z_grid)) else: print('Girl fix your system') theta = np.linspace(np.min(theta), np.max(theta), len(self.table.r_grid)) elif isinstance(self.theta_bins, int): theta = u.Quantity(np.linspace(np.min(theta), np.max(theta), self.theta_bins)) else: raise CHEFTypeError("theta_bins should be None or int, not %s (%s)", type(self.theta_bins), self.theta_bins) elif self.table.coord_base == 'sphere': if self.radii_bins is None: radii = np.sort(np.unique(self.table.d)).to(u.cm) if self.outer_radius is not None: radii = radii[radii <= self.outer_radius] self._check_outer_radius() elif isinstance(self.radii_bins, int): if self.outer_radius is None: outer_radius = self.table.d.max() else: outer_radius = self.outer_radius self._check_outer_radius() radii = np.geomspace(self.table.d.min(), outer_radius, self.radii_bins).to(u.cm) else: raise CHEFTypeError("radii_bins should be None or int, not %s (%s)", type(self.radii_bins), self.radii_bins) if self.theta_bins is None: theta = u.Quantity(np.sort(np.unique(self.table.theta))) elif isinstance(self.theta_bins, int): theta = u.Quantity(np.linspace(np.min(self.table.theta), np.max(self.table.theta), self.theta_bins)) else: raise CHEFTypeError("theta_bins should be None or int, not %s (%s)", type(self.theta_bins), self.theta_bins) if self.table.dims == '3d': if self.phi_bins is None: phi = u.Quantity(self.table.phi_grid) elif isinstance(self.phi_bins, int): phi = u.Quantity(np.linspace(np.min(self.table.phi), np.max(self.table.phi), self.phi_bins)) else: raise CHEFTypeError("phi_bins should be None or int, not %s (%s)", type(self.phi_bins), self.phi_bins) # zr = np.tan(np.pi / 2 * u.rad - theta) # self.zr_edges = np.array([zr[0], *(0.5 * (zr[1:] + zr[:-1])), zr[-1]]) # self.theta_edges = np.sort(np.pi / 2 - np.arctan(self.zr_edges)) self.phi_edges = [0, 2*np.pi] if self.table.coord_style == 'center': self.radii_edges = u.Quantity([radii[0], *np.sqrt(radii[1:] * radii[:-1]), radii[-1]]).value self.theta_edges = u.Quantity([theta[0], *(0.5 * (theta[1:] + theta[:-1])), theta[-1]]).value if self.theta_edges[0] < 0.01: self.theta_edges[0] = 0 if self.table.dims == '3d': self.phi_edges = u.Quantity([phi[0], *(0.5 * (phi[1:] + phi[:-1])), phi[-1]]).value elif self.table.coord_style == 'edge': self.radii_edges = radii.value self.theta_edges = theta.value if self.table.dims == '3d': self.phi_edges = phi.value if not True in (self.theta_edges == np.pi/2): hind = np.argmin(np.abs(self.theta_edges - np.pi/2)) self.theta_edges[hind] = np.pi/2 if self.table.coord_style == 'center': if self.table.dims == '2d': R, THETA = np.meshgrid(radii, theta) if self.table.dims == '3d': PHI, THETA, R = np.meshgrid(phi, theta, radii, indexing='ij') if self.table.coord_style == 'edge': if self.table.dims == '2d': R, THETA = np.meshgrid(np.sqrt(radii[1:] * radii[:-1]), 0.5 * (theta[1:] + theta[:-1])) if self.table.dims == '3d': PHI, THETA, R = np.meshgrid(0.5 * (phi[1:] + phi[:-1]), 0.5 * (theta[1:] + theta[:-1]), np.sqrt(radii[1:] * radii[:-1]), indexing='ij') self.polar_table = CTable(dims=self.table.dims, coord_base='sphere') self.polar_table['Distance to star'] = R.flatten() self.polar_table['Theta'] = THETA.flatten() << u.rad if self.table.dims == '3d': self.polar_table['Phi'] = PHI.flatten() << u.rad self.polar_table['Altitude'] = (np.pi / 2 * u.rad - self.polar_table['Theta']) << u.rad self.polar_table['Height to radius'] = np.tan(self.polar_table['Altitude']) self.polar_table['Height'] = self.polar_table['Distance to star'] * np.sin(self.polar_table['Altitude']) self.polar_table['Radius'] = self.polar_table['Distance to star'] * np.cos(self.polar_table['Altitude']) # if self.table.dims == '2d': # self.polar_table.sort(['Theta', 'Distance to star']) # if self.table.dims == '3d': # self.polar_table.sort(['Phi', 'Theta', 'Distance to star']) self.polar_table['Velocity R'] = 0 * u.cm / u.s self.polar_table['Velocity Theta'] = 0 * u.cm / u.s try: star_mass = self.chemistry.physics.star_mass except: star_mass = self.chemistry.m_star self.polar_table['Velocity Phi'] = ( np.sqrt( c.G * star_mass / self.polar_table['Distance to star'] ) * np.sin(self.polar_table['Theta']) ).to(u.cm / u.s) try: if self.chemistry.read_envelope or self.chemistry.read_settling: self.interpolate('Envelope mask') self.polar_table['Envelope mask'] = self.polar_table['Envelope mask'].round().astype(int) env_types = np.sort(np.unique(self.polar_table['Envelope mask'])) if len(env_types) > 1: for dt in env_types: dtmask = self.polar_table['Envelope mask'] == dt if dt==0: #disk continue elif dt==1: #envelope self.polar_table['Velocity R'][dtmask] = ( np.sqrt( 2 * c.G * star_mass / self.polar_table['Distance to star'][dtmask] ) ).to(u.cm / u.s) self.polar_table['Velocity Phi'][dtmask] = 0 elif dt==2: #cavity continue #tbd some kind of fly-away except AttributeError: pass self.nrcells = (len(self.radii_edges) - 1) * (len(self.theta_edges) - 1) * (len(self.phi_edges) - 1) self.fitsfiles = [] """List of created FITS files""" self.outputs = {} def _check_outer_radius(self): pass # total_mass = np.trapz(self.table.r * np.trapz(self.table["Gas density"], self.table.z)) # total_mass_outside_outer_radius = np.trapz(self.table.r * ) # self.logger.warning("The outer radius %s contains only %s per cent of the total disk mass", self.outer_radius) @property def mode(self) -> str: """Mode of RadMC: `mctherm`, `image`, `spectrum`, `sed`""" raise NotImplementedError def catch_radmc_messages(self, proc: subprocess.CompletedProcess) -> None: """Raises RadMC warnings and errors in `self.logger`""" if proc.stderr: self.logger.error(proc.stderr) self.logger.debug(proc.stdout) for match in re.finditer(r"WARNING:(.*\n(?: .*\n){2,})", proc.stdout): if "In the molecular data file" in match.group(1): self.logger.info(match.group(1)) else: self.logger.warn(match.group(1)) for match in re.finditer(r"ERROR:(.*\n(?: .*\n){2,})", proc.stdout): self.logger.error(match.group(1)) def interpolate(self, column: str, method: Literal['linear', 'nearest', 'cubic'] = 'linear') -> None: """Adds a new `column` to `self.polar_table` with the data iterpolated from `self.table`""" if self.table.dims == '2d': self.polar_table[column] = self.table.interpolate(column, method=method)(self.polar_table.r, self.polar_table.z) if self.table.dims == '3d': self.polar_table[column] = self.table.interpolate3d(column, method=method)(self.polar_table.r, self.polar_table.z, self.polar_table.phi) def interpolate_back(self, column: str) -> None: """Adds a new `column` to `self.table` with the data iterpolated from `self.polar_table`""" if self.polar_table.dims == '2d': self.table[column] = self.polar_table.interpolate(column)(self.table.r, self.table.z) if self.polar_table.dims == '3d': self.table[column] = self.polar_table.interpolate3d(column)(self.table.r, self.table.z, self.table.phi) def create_files(self) -> None: """Creates all the files necessary to run RadMC3D""" self.radmc3d() self.wavelength_micron() self.amr_grid() self.external_source() self.logger.info("Files written to %s", self.folder) def radmc3d(self, out_file: PathLike = None) -> None: """Creates an empty `radmc3d.inp` file""" if out_file is None: out_file = os.path.join(self.folder, 'radmc3d.inp') with open(out_file, 'w') as file: if self.scattering_mode_max is not None: print(f"scattering_mode_max = {self.scattering_mode_max}", file=file) if self.modified_random_walk: print("modified_random_walk = 1", file=file) if self.nphot_therm is not None: print(f"nphot_therm = {int(self.nphot_therm)}", file=file) if self.nphot_mono is not None: print(f"nphot_mono = {int(self.nphot_mono)}", file=file) if self.nphot_spec is not None: print(f"nphot_spec = {int(self.nphot_spec)}", file=file) if self.nphot_scat is not None: print(f"nphot_scat = {int(self.nphot_scat)}", file=file) if self.istar_sphere is not None: print(f"istar_sphere = {int(self.istar_sphere)}", file=file) if self.nphotdiff is not None: print(f"nphotdiff = {self.nphotdiff}", file=file) if self.mc_scat_maxtauabs is not None: print(f"mc_scat_maxtauabs = {self.mc_scat_maxtauabs}", file=file) if self.nphotdiff_type is not None: print(f"nphotdiff_type = {int(self.nphotdiff_type)}", file=file) def wavelength_micron(self, out_file: PathLike = None) -> None: """Creates a `wavelength_micron.inp` file""" if out_file is None: out_file = os.path.join(self.folder, 'wavelength_micron.inp') with open(out_file, 'w') as file: print(len(self.wavelengths), file=file) print('\n'.join(f"{entry.to(u.um).value:.7e}" for entry in self.wavelengths), file=file) def external_source(self, out_file: PathLike = None) -> None: """Creates an `external_source.inp` file""" if self.external_source_type is None or self.external_source_type == "None": return elif self.external_source_type == "Draine1978": isrf = diskchef.maps.radiation_fields.draine1978 elif self.external_source_type == "WeingartnerDraine2001": isrf = diskchef.maps.radiation_fields.weingartner_draine_2001 else: raise CHEFNotImplementedError("Unsupported ISRF") if out_file is None: out_file = os.path.join(self.folder, 'external_source.inp') with open(out_file, 'w') as file: print("2", file=file) print(len(self.wavelengths), file=file) print('\n'.join(f"{entry.to(u.um).value:.7e}" for entry in self.wavelengths), file=file) print( '\n'.join( f"{entry:.7e}" for entry in self.external_source_multiplier * isrf(self.wavelengths).to( u.erg / u.cm ** 2 / u.s / u.Hz / u.sr).value), file=file) def amr_grid(self, out_file: PathLike = None) -> None: """Creates a `amr_grid.inp` file""" # if not self.table.is_in_zr_regular_grid: # raise CHEFNotImplementedError if out_file is None: out_file = os.path.join(self.folder, 'amr_grid.inp') with open(out_file, 'w') as file: print('1', file=file) # Typically 1 at present print('0', file=file) # Grid style (regular = 0) print('100', file=file) # Spherical coordinate system print('1' if self.verbosity else '0', file=file) # Grid info if self.table.dims == '2d': print('1 1 0', file=file) # Included coordinates if self.table.dims == '3d': print('1 1 1', file=file) # Included coordinates print(len(self.radii_edges) - 1, len(self.theta_edges) - 1, len(self.phi_edges) - 1, file=file) print(' '.join(f"{entry:.7e}" for entry in self.radii_edges), file=file) print(' '.join(f"{entry:.7e}" for entry in self.theta_edges), file=file) print(' '.join(f"{entry:.7e}" for entry in self.phi_edges), file=file) @u.quantity_input def run( self, inclination: u.deg = 0 * u.deg, position_angle: u.deg = 0 * u.deg, distance: u.pc = 140 * u.pc, velocity_offset: u.km / u.s = 0 * u.km / u.s, threads: int = 1, npix: int = 100, ) -> None: """Run RadMC3D after files were created with `create_files()`""" raise CHEFNotImplementedErrorAncestors
Subclasses
Class variables
var coordinate : Union[str, astropy.coordinates.sky_coordinate.SkyCoord]var executable : Union[str, os.PathLike]var external_source_multiplier : floatvar external_source_type : Literal['Draine1978', 'WeingartnerDraine2001', 'None']var folder : Union[str, os.PathLike]var istar_sphere : intvar mc_scat_maxtauabs : floatvar modified_random_walk : boolvar nphot_mono : intvar nphot_scat : intvar nphot_spec : intvar nphot_therm : intvar nphotdiff : floatvar nphotdiff_type : intvar outer_radius : Optional[None]var phi_bins : Optional[None]var radii_bins : Optional[None]var scattering_mode_max : intvar theta_bins : Optional[None]var verbosity : intvar wavelengths : astropy.units.quantity.Quantity
Instance variables
prop mode : str-
Mode of RadMC:
mctherm,image,spectrum,sedExpand source code
@property def mode(self) -> str: """Mode of RadMC: `mctherm`, `image`, `spectrum`, `sed`""" raise NotImplementedError
Methods
def amr_grid(self, out_file: Union[str, os.PathLike] = None) ‑> None-
Creates a
amr_grid.inpfile def catch_radmc_messages(self, proc: subprocess.CompletedProcess) ‑> None-
Raises RadMC warnings and errors in
self.logger def create_files(self) ‑> None-
Creates all the files necessary to run RadMC3D
def external_source(self, out_file: Union[str, os.PathLike] = None) ‑> None-
Creates an
external_source.inpfile def interpolate(self, column: str, method: Literal['linear', 'nearest', 'cubic'] = 'linear') ‑> None-
Adds a new
columntoself.polar_tablewith the data iterpolated fromself.table def interpolate_back(self, column: str) ‑> None-
Adds a new
columntoself.tablewith the data iterpolated fromself.polar_table def radmc3d(self, out_file: Union[str, os.PathLike] = None) ‑> None-
Creates an empty
radmc3d.inpfile def run(self, inclination: Unit("deg") = <Quantity 0. deg>, position_angle: Unit("deg") = <Quantity 0. deg>, distance: Unit("pc") = <Quantity 140. pc>, velocity_offset: Unit("km / s") = <Quantity 0. km / s>, threads: int = 1, npix: int = 100) ‑> None-
Run RadMC3D after files were created with
create_files() def wavelength_micron(self, out_file: Union[str, os.PathLike] = None) ‑> None-
Creates a
wavelength_micron.inpfile
class RadMCOutput (line: Line, file_radmc: Union[str, os.PathLike] = None, file_fits: Union[str, os.PathLike] = None, object_name: str = '', distance: Unit("pc") = None, cloud: Cloud = None, mode: Literal['image', 'image tracetau'] = 'image')-
Class to store information and visualize the RadMCRT module output
Expand source code
class RadMCOutput: """Class to store information and visualize the RadMCRT module output""" line: Line file_radmc: PathLike = None file_fits: PathLike = None object_name: str = "" distance: u.pc = None cloud: Cloud = None mode: Literal["image", "image tracetau"] = "image" def __post_init__(self): self.logger = logging.getLogger(__name__ + '.' + self.__class__.__qualname__) self.logger.info("Creating an instance of %s", self.__class__.__qualname__) self.logger.debug("With parameters: %s", self.__dict__) @staticmethod def gauss(x, H, A, x0, sigma): """Gaussian function with a background""" return H + A * np.exp(-(x - x0) ** 2 / (2 * sigma ** 2)) @classmethod def gauss_fit(cls, x, y): """Fit a gaussian into data""" mean = sum(x * y) / sum(y) sigma = np.sqrt(sum(y * (x - mean) ** 2) / sum(y)) popt, pcov = curve_fit(cls.gauss, x, y, p0=[min(y), max(y), mean, sigma]) return popt @classmethod def sigma_from_data(cls, data: np.ndarray) -> float: """Find rms of the data by fitting a gaussian into the histogram (assuming most of the pixels are noise)""" values, edges = np.histogram(data, bins=100, density=True) means = 0.5 * (edges[1:] + edges[:-1]) params = cls.gauss_fit(means, values) # plt.step(means, values, where="mid") # print(params) # plt.plot(means, cls.gauss(means, *params)) return params[3] def finalize_plot(self, axes, cube, window, ctr_data=None, ellcolor="black", **kwargs): """Finalize the channel or moment map figure.""" dist_pc = self.distance.to_value(u.pc) pxsize = np.sqrt(np.abs(np.linalg.det(cube.wcs.celestial.pixel_scale_matrix))) try: axes.coords[0].set_major_formatter('hh:mm:ss') axes.coords[1].set_major_formatter('dd:mm:ss') axes.coords[0].set_ticks(spacing=5 * u.arcsec) # , format="hh:mm:ss") axes.coords[1].set_ticks(spacing=5 * u.arcsec) # , format="dd:mm:ss") axes.coords[0].set_ticklabel(exclude_overlapping=True) axes.coords[1].set_ticklabel(exclude_overlapping=True) except AttributeError: pass axes.scatter( 0, 0, color='white', marker='x', zorder=100 ) if ctr_data is not None: noise = self.sigma_from_data(ctr_data) noise_value = getattr(noise, "value", noise) ctr_3sigma = axes.contour( ctr_data, levels=[3 * noise_value], colors='black', linewidths=0.5, ) else: ctr_3sigma = None try: ell = matplotlib.patches.Ellipse( (-0.8 * window, -0.8 * window), cube.beam.major.to_value(u.arcsec) * dist_pc, cube.beam.minor.to_value(u.arcsec) * dist_pc, cube.beam.pa.value + 90, hatch='///', color=ellcolor ) axes.add_patch(ell) except spectral_cube.utils.NoBeamError as e: pass return {"ctr_3sigma": ctr_3sigma} def _check_distance(self): if self.distance is None: try: self.logger.warning( "Distance is not set. Querying from Simbad, but it is not free. " "Provide `distance` argument to RadMCOutput instead") from astroquery.simbad import Simbad simquery = Simbad() simquery.add_votable_fields('distance', 'velocity') self.distance = simquery.query_object(self.object_name)[0]["Distance_distance"] * u.pc except ImportError: self.logger.warning( "Distance to the object was not set. astroquery is not installed. Cannot query Simbad." ) except Exception as e: self.logger.warning("Something went wrong querying Simbad: %s", e) @cached_property def unit_for_channel_map(self) -> u.Unit: if self.mode == "image": return u.K elif self.mode == "image tracetau": return u.dimensionless_unscaled elif self.mode == "tausurf": return u.au else: self.logger.error("Unknown mode %s") return u.dimensionless_unscaled def plot_channel_map( self, window=500 * u.au, cmap: Union[matplotlib.colors.Colormap, str] = None, velocity_offset: u.km / u.s = 0 * u.km / u.s, nx=4, ny=4, ) -> Figure: symnorm = False if cmap is None: if self.mode == "tausurf": cmap = "coolwarm" symnorm = True else: cmap = "Blues" cube = SpectralCube.read(self.file_fits) center = cube.wcs.celestial.pixel_to_world(cube.shape[1] / 2, cube.shape[2] / 2) self._check_distance() radius = ( window / self.distance ).to( u.arcsec, equivalencies=u.dimensionless_angles() ) region = CircleSkyRegion(center, radius) cube.allow_huge_operations = True cube: SpectralCube = ( cube.subcube_from_regions([region]) .with_spectral_unit(u.km / u.s, velocity_convention="radio") ) try: cube = cube.to(self.unit_for_channel_map) except ValueError as e: if cube._beam is None: cube = cube.with_beam(Beam(1e-10 * u.arcsec)).to(self.unit_for_channel_map) else: raise ValueError(e) central_channel = cube.closest_spectral_channel(velocity_offset) # downsampled: SpectralCube = cube.downsample_axis(4, axis=0).with_spectral_unit(u.km / u.s) downsampled = cube[central_channel - nx * ny // 2: central_channel + nx * ny // 2 + 1] maxval = round(0.9 * downsampled.max().value, 1) if symnorm: norm = Normalize(-maxval, maxval) else: norm = Normalize(0, maxval) aspect_ratio = downsampled.shape[2] / float(downsampled.shape[1]) fig_smallest_dim_inches = 5 gridratio = ny / float(nx) * aspect_ratio if gridratio > 1: ysize = fig_smallest_dim_inches * gridratio xsize = fig_smallest_dim_inches else: xsize = fig_smallest_dim_inches * gridratio ysize = fig_smallest_dim_inches fig: Figure = plt.figure(figsize=(xsize, ysize)) gs = GridSpec(nrows=ny, ncols=nx, hspace=0.0, wspace=0.0, figure=fig) ax = None window, window_unit = window.value, window.unit window_half = round(window * 0.6, ndigits=-2) for i in range(ny): for j in range(nx): ax = fig.add_subplot( gs[i, j], sharex=ax, sharey=ax ) im = ax.imshow( downsampled[i * nx + j].value, cmap=cmap, norm=norm, origin="lower", extent=[-window, window, -window, window], ) self.finalize_plot(ax, downsampled, window) this_spectral_coordinate = downsampled.spectral_axis[i * nx + j] ax.text( 0.5, 0.9, f"{this_spectral_coordinate.value: .1f} {this_spectral_coordinate.unit.to_string('latex_inline')}", horizontalalignment='center', verticalalignment='center', transform=ax.transAxes, fontsize="small" ) if self.cloud is not None: velocity = downsampled.spectral_axis[i * nx + j] if self.cloud.velocity_min < velocity < self.cloud.velocity_max: ax.scatter(0.5, 0.5, marker='x', color='red', alpha=0.2, transform=ax.transAxes, s=2000) if i != ny - 1: plt.setp(ax.get_xticklabels(), visible=False) else: ax.set_xticks([-window_half, 0, window_half]) if j != 0: plt.setp(ax.get_yticklabels(), visible=False) else: ax.set_yticks([-window_half, 0, window_half]) if i == ny - 1 and j == 0: ax.set_xlabel(f"[{window_unit.to_string('latex_inline')}]") ax.set_ylabel(f"[{window_unit.to_string('latex_inline')}]", labelpad=-18) else: cax = fig.add_axes([0.90, 0.1, 0.03, 0.8]) cb = fig.colorbar(im, cax=cax) cb.ax.set_xlabel(f"\n[{downsampled.unit.to_string('latex')}]") gs.update(left=0.1, right=0.9, top=0.9, bottom=0.1) fig.suptitle(f"{self.object_name} {chemical_names.from_string(self.line.molecule)}") return figClass variables
var cloud : Cloudvar distance : Unit("pc")var file_fits : Union[str, os.PathLike]var file_radmc : Union[str, os.PathLike]var line : Linevar mode : Literal['image', 'image tracetau']var object_name : str
Static methods
def gauss(x, H, A, x0, sigma)-
Gaussian function with a background
def gauss_fit(x, y)-
Fit a gaussian into data
def sigma_from_data(data: numpy.ndarray) ‑> float-
Find rms of the data by fitting a gaussian into the histogram (assuming most of the pixels are noise)
Instance variables
var unit_for_channel_map-
Expand source code
def __get__(self, instance, owner=None): if instance is None: return self if self.attrname is None: raise TypeError( "Cannot use cached_property instance without calling __set_name__ on it.") try: cache = instance.__dict__ except AttributeError: # not all objects have __dict__ (e.g. class defines slots) msg = ( f"No '__dict__' attribute on {type(instance).__name__!r} " f"instance to cache {self.attrname!r} property." ) raise TypeError(msg) from None val = cache.get(self.attrname, _NOT_FOUND) if val is _NOT_FOUND: with self.lock: # check if another thread filled cache while we awaited lock val = cache.get(self.attrname, _NOT_FOUND) if val is _NOT_FOUND: val = self.func(instance) try: cache[self.attrname] = val except TypeError: msg = ( f"The '__dict__' attribute on {type(instance).__name__!r} instance " f"does not support item assignment for caching {self.attrname!r} property." ) raise TypeError(msg) from None return val
Methods
def finalize_plot(self, axes, cube, window, ctr_data=None, ellcolor='black', **kwargs)-
Finalize the channel or moment map figure.
def plot_channel_map(self, window=<Quantity 500. AU>, cmap: Union[matplotlib.colors.Colormap, str] = None, velocity_offset: Unit("km / s") = <Quantity 0. km / s>, nx=4, ny=4) ‑> matplotlib.figure.Figure
class RadMCVisualize (folder: Union[str, os.PathLike] = '.', line: Line = None)-
RadMCVisualize(folder: Union[str, os.PathLike] = '.', line: diskchef.lamda.line.Line = None)
Expand source code
class RadMCVisualize: folder: PathLike = '.' line: Line = None def channel_map(self) -> None: logging.warning("Deprecated") for file in sorted(glob.glob(os.path.join(self.folder, "*image.out"))): im = radmc3dPy.image.readImage(fname=file) normalizer = Normalize(vmin=im.image.min(), vmax=im.image.max()) nrow = 5 ncol = 8 fig, axes = plt.subplots( nrow, ncol, sharey='row', sharex='col', gridspec_kw=dict(wspace=0.0, hspace=0.0, top=1. - 0.5 / (nrow + 1), bottom=0.5 / (nrow + 1), left=0.5 / (ncol + 1), right=1 - 0.5 / (ncol + 1)), figsize=(ncol + 1, nrow + 1) ) for i, ax in enumerate(axes.flatten()): ax.imshow(im.image[:, :, i], norm=normalizer) axes_f = axes.flatten() cbaxes = fig.add_axes( [axes_f[-1].figbox.x1, axes_f[-1].figbox.y0, 0.1 * (axes_f[-1].figbox.x1 - axes_f[-1].figbox.x0), axes_f[-1].figbox.y1 - axes_f[-1].figbox.y0] ) plt.subplots_adjust(hspace=0.01, wspace=0.01) cbim = axes_f[-1].images[0] clbr = fig.colorbar(cbim, cax=cbaxes) fig.suptitle(file) fig.savefig(file + ".png")Class variables
var folder : Union[str, os.PathLike]var line : Line
Methods
def channel_map(self) ‑> None