diff --git a/Notebooks.ipynb b/Notebooks.ipynb new file mode 100644 index 0000000..65b8a4e --- /dev/null +++ b/Notebooks.ipynb @@ -0,0 +1 @@ +{"metadata":{"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kernelspec":{"name":"python3","display_name":"Python 3 (ipykernel)","language":"python"}},"nbformat_minor":5,"nbformat":4,"cells":[{"cell_type":"markdown","source":"**How to Use Collision Unit**\n\n*Collision Unit* has the API functions for plasma diagnostics and abundance analysis of collisionally excited lines. Here are some examples of using Collision Unit:","metadata":{"tags":[]},"id":"c71e6d2f-542b-4d92-b1ce-df7a7516f283"},{"cell_type":"markdown","source":"* *Temperature*:","metadata":{},"id":"afe1c029-9e21-4689-a30d-b0db87e01da5"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_dir = os.path.join('atomic-data', 'chianti70')\natom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\natom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\natom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n\natom = 's'\nion = 'ii'\ns_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\ns_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\ns_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n\nupper_levels='1,2,1,3/'\nlower_levels='1,5/'\ndensity = np.float64(2550)\nline_flux_ratio=np.float64(10.753)\ntemperature = pyequib.calc_temperature(line_flux_ratio=line_flux_ratio, density=density,\n upper_levels=upper_levels, lower_levels=lower_levels,\n elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\nprint(\"Electron Temperature:\", temperature)","metadata":{"trusted":true},"execution_count":1,"outputs":[{"name":"stdout","text":"Electron Temperature: 7920.286541685719\n","output_type":"stream"}],"id":"9bb626da-176e-40d7-9b13-6ba5d2155fe3"},{"cell_type":"markdown","source":"* *Density*:","metadata":{},"id":"632f133e-22ed-4b6f-9774-c543049dc944"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_dir = os.path.join('atomic-data', 'chianti70')\natom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\natom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\natom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n\natom = 's'\nion = 'ii'\ns_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\ns_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\ns_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n\nupper_levels='1,2/'\nlower_levels='1,3/'\ntemperature=np.float64(7000.0)#\nline_flux_ratio=np.float64(1.506)#\ndensity = pyequib.calc_density(line_flux_ratio=line_flux_ratio, temperature=temperature,\n upper_levels=upper_levels, lower_levels=lower_levels,\n elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\nprint(\"Electron Density:\", density)","metadata":{"trusted":true},"execution_count":2,"outputs":[{"name":"stdout","text":"Electron Density: 2312.6163694558754\n","output_type":"stream"}],"id":"bd53e19f-d0b5-4c39-b552-f265575f5f5b"},{"cell_type":"markdown","source":"* *Ionic Abundance*:","metadata":{},"id":"a53a1436-8770-4e1d-9bdf-0365ff416507"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_dir = os.path.join('atomic-data', 'chianti70')\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\natom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\natom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'h'\nion = 'ii' # H I Rec\nhi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\natom = 'o'\nion = 'iii' # [O III]\no_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)\no_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)\no_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)\n\nlevels5007='3,4/'\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\niobs5007=np.float64(1200.0)\nabb5007 = pyequib.calc_abundance(temperature=temperature, density=density,\n line_flux=iobs5007, atomic_levels=levels5007,\n elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij,\n h_i_aeff_data=hi_rc_data['aeff'][0])\nprint('N(O^2+)/N(H+):', abb5007)","metadata":{"trusted":true},"execution_count":3,"outputs":[{"name":"stdout","text":"N(O^2+)/N(H+): 0.00041256231615518905\n","output_type":"stream"}],"id":"516f7320-aa04-4a44-a4b7-4107b49e9269"},{"cell_type":"markdown","source":"* *Emissivity*:","metadata":{},"id":"15e2cd7c-0286-4e88-8771-804e2a655d55"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_dir = os.path.join('atomic-data', 'chianti70')\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\natom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\natom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'h'\nion = 'ii' # H I Rec\nhi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\natom = 'o'\nion = 'iii' # [O III]\no_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)\no_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)\no_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)\n\nlevels5007='3,4/'\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\niobs5007=np.float64(1200.0)\nemis = pyequib.calc_emissivity(temperature=temperature, density=density, atomic_levels=levels5007,\n elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij)\nprint('Emissivity(O III 5007):', emis)","metadata":{"trusted":true},"execution_count":4,"outputs":[{"name":"stdout","text":"Emissivity(O III 5007): 3.604101086770835e-21\n","output_type":"stream"}],"id":"f73dd3d0-1518-4599-8197-bd925c0e17e7"},{"cell_type":"markdown","source":"* *Atomic Level Population*:","metadata":{},"id":"5c0b5636-420d-4386-b8e1-023af8f668a5"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_dir = os.path.join('atomic-data', 'chianti70')\natom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\natom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\natom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n\natom = 's'\nion = 'ii'\ns_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\ns_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\ns_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n\ndensity = np.float64(1000)\ntemperature=np.float64(10000.0)#\nnlj = pyequib.calc_populations(temperature=temperature, density=density,\n elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\nprint('Populations:', nlj)","metadata":{"trusted":true},"execution_count":5,"outputs":[{"name":"stdout","text":"Populations: [9.69927956e-01 7.00374036e-03 2.30625169e-02 2.65941581e-06\n 3.12775934e-06]\n","output_type":"stream"}],"id":"da4d9c29-4cdc-44df-8d7b-45c09b229ee0"},{"cell_type":"markdown","source":"* *Critical Density*:","metadata":{},"id":"02c041ec-626c-42f0-8e99-0a1baa79989f"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_dir = os.path.join('atomic-data', 'chianti70')\natom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\natom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\natom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n\natom = 's'\nion = 'ii'\ns_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\ns_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\ns_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n\ntemperature=np.float64(10000.0)\nn_crit = pyequib.calc_crit_density(temperature=temperature,\n elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\nprint('Critical Densities:', n_crit)","metadata":{"trusted":true},"execution_count":6,"outputs":[{"name":"stdout","text":"Critical Densities: [0.00000000e+00 5.00783964e+03 1.73284137e+03 1.07268504e+06\n 2.22075807e+06]\n","output_type":"stream"}],"id":"59261bc4-8c8c-4d91-a62a-1df26b561f12"},{"cell_type":"markdown","source":"* *All Ionic Level Information*:","metadata":{},"id":"4a68435d-6449-42dc-9c9d-fb5718273f75"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_dir = os.path.join('atomic-data', 'chianti70')\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\natom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\natom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'h'\nion = 'ii' # H I Rec\nhi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\natom = 'o'\nion = 'iii' # [O III]\no_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)\no_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)\no_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\npyequib.print_ionic(temperature=temperature, density=density,\n elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij,\n h_i_aeff_data=hi_rc_data['aeff'][0])","metadata":{"trusted":true},"execution_count":7,"outputs":[{"name":"stdout","text":"Temperature = 10000.0 K\nDensity = 5000.0 cm-3\n\nLevel Populations Critical Densities\nLevel 1: 1.556E-01 0.000E+00\nLevel 2: 4.269E-01 4.908E+02\nLevel 3: 4.172E-01 3.419E+03\nLevel 4: 2.221E-04 6.853E+05\nLevel 5: 1.522E-08 2.547E+07\n\n 2.597E-05 \n 88.34um \n (2-->1) \n 4.986E-23 \n\n 0.000E+00 9.632E-05 \n 32.66um 51.81um \n (3-->1) (3-->2) \n 0.000E+00 3.081E-22 \n\n 2.322E-06 6.791E-03 2.046E-02 \n 4932.60A 4960.29A 5008.24A \n (4-->1) (4-->2) (4-->3) \n 4.153E-25 1.208E-21 3.604E-21 \n\n 0.000E+00 2.255E-01 6.998E-04 1.685E+00 \n 2315.58A 2321.67A 2332.12A 4364.45A \n (5-->1) (5-->2) (5-->3) (5-->4) \n 0.000E+00 5.875E-24 1.815E-26 2.335E-23 \n\nH-beta emissivity: 1.239E-25 N(H+) Ne [erg/s]\n","output_type":"stream"}],"id":"177e009d-8ddd-42b2-83da-cc04bbb1ccc5"},{"cell_type":"markdown","source":"**How to Use Recombination Unit**\n\n*Recombination Unit* has the API functions for plasma diagnostics and abundance analysis of recombination lines. Here are some examples of using Recombination Unit:","metadata":{},"id":"ce86cc3c-9c7e-4c2b-9208-bbe1f627ae72"},{"cell_type":"markdown","source":"* *He+ Ionic Abundance*:","metadata":{},"id":"4ebb5bce-e701-48a3-ad84-d63b6fe4e1b9"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_he_i_file = os.path.join(base_dir,data_rc_dir, 'rc_he_ii_PFSD12.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\natom = 'he'\nion = 'ii' # He I\nhe_i_rc_data = atomneb.read_aeff_he_i_pfsd12(atom_rc_he_i_file, atom, ion)\n\nh_i_aeff_data = h_i_rc_data['aeff'][0]\nhe_i_aeff_data = he_i_rc_data['aeff'][0]\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nhe_i_4471_flux= 2.104\nlinenum=10# 4471.50\nabund_he_i = pyequib.calc_abund_he_i_rl(temperature=temperature, density=density,\n linenum=linenum, line_flux=he_i_4471_flux,\n he_i_aeff_data=he_i_aeff_data, h_i_aeff_data=h_i_aeff_data)\nprint('N(He^+)/N(H^+):', abund_he_i)","metadata":{"trusted":true},"execution_count":8,"outputs":[{"name":"stdout","text":"N(He^+)/N(H^+): 0.04084839075818239\n","output_type":"stream"}],"id":"24a1985c-cda2-4592-b66e-a8014bf6c422"},{"cell_type":"markdown","source":"* *He++ Ionic Abundance*:","metadata":{},"id":"72ba0d7c-0838-455e-8ead-c52faf40ee1c"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\natom = 'he'\nion = 'iii' # He II\nhe_ii_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\nh_i_aeff_data = h_i_rc_data['aeff'][0]\nhe_ii_aeff_data = he_ii_rc_data['aeff'][0]\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nhe_ii_4686_flux = 135.833\nabund_he_ii = pyequib.calc_abund_he_ii_rl(temperature=temperature, density=density,\n line_flux=he_ii_4686_flux,\n he_ii_aeff_data=he_ii_aeff_data, h_i_aeff_data=h_i_aeff_data)\nprint('N(He^2+)/N(H^+):', abund_he_ii)","metadata":{"trusted":true},"execution_count":9,"outputs":[{"name":"stdout","text":"N(He^2+)/N(H^+): 0.11228817602605204\n","output_type":"stream"}],"id":"590d7f3b-9e4b-4a57-9067-3cbafcfed8ac"},{"cell_type":"markdown","source":"* *C++ Ionic Abundance*:","metadata":{},"id":"5a6f3980-ebbf-4257-825c-04a5ceb641d8"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'c'\nion = 'iii' # C II\nc_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nwavelength=6151.43\nc_ii_6151_flux = 0.028\nabund_c_ii = pyequib.calc_abund_c_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength, line_flux=c_ii_6151_flux,\n c_ii_rc_data=c_ii_rc_data, h_i_aeff_data=h_i_aeff_data)\nprint('N(C^2+)/N(H+):', abund_c_ii)","metadata":{"trusted":true},"execution_count":10,"outputs":[{"name":"stdout","text":"N(C^2+)/N(H+): 0.0006340465212764737\n","output_type":"stream"}],"id":"e2a63739-2360-4af6-bf3b-3cb8cf09c84f"},{"cell_type":"markdown","source":"* *C3+ Ionic Abundance*:","metadata":{},"id":"f91756b8-7d60-4ba8-813d-d12e60772036"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'c'\nion = 'iv' # C III\nc_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nwavelength=4647.42\nc_iii_4647_flux = 0.107\nabund_c_iii = pyequib.calc_abund_c_iii_rl(temperature=temperature, density=density,\n wavelength=wavelength,\n line_flux=c_iii_4647_flux, c_iii_rc_data=c_iii_rc_data,\n h_i_aeff_data=h_i_aeff_data)\nprint('N(C^3+)/N(H+):', abund_c_iii)","metadata":{"trusted":true},"execution_count":11,"outputs":[{"name":"stdout","text":"N(C^3+)/N(H+): 0.00017502841174667208\n","output_type":"stream"}],"id":"46ec9ec3-68e3-451a-9360-be233383e181"},{"cell_type":"markdown","source":"* *N++ Ionic Abundance*:","metadata":{},"id":"41c461ce-bef3-407d-90c7-57170be4c707"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'n'\nion = 'iii' # N II\nn_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\nn_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\nwavelength=4442.02\nn_ii_4442_flux = 0.017\nabund_n_ii = pyequib.calc_abund_n_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength, line_flux=n_ii_4442_flux,\n n_ii_rc_br=n_ii_rc_data_br, n_ii_rc_data=n_ii_rc_data,\n h_i_aeff_data=h_i_aeff_data)\nprint('N(N^2+)/N(H+):', abund_n_ii)","metadata":{"trusted":true},"execution_count":12,"outputs":[{"name":"stdout","text":"N(N^2+)/N(H+): 0.0006929753817578532\n","output_type":"stream"}],"id":"4b855ffd-881f-4a33-bedc-91cb19322573"},{"cell_type":"markdown","source":"* *N3+ Ionic Abundance*:","metadata":{},"id":"31499ae2-5258-4e7f-82d2-e95d97f2670c"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'n'\nion = 'iv' # N III\nn_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\nwavelength=4640.64\nn_iii_4641_flux = 0.245\nabund_n_iii = pyequib.calc_abund_n_iii_rl(temperature=temperature, density=density,\n wavelength=wavelength, line_flux=n_iii_4641_flux,\n n_iii_rc_data=n_iii_rc_data, h_i_aeff_data=h_i_aeff_data)\nprint('N(N^3+)/N(H+):', abund_n_iii)","metadata":{"trusted":true},"execution_count":13,"outputs":[{"name":"stdout","text":"N(N^3+)/N(H+): 6.336617797779891e-05\n","output_type":"stream"}],"id":"5b150648-1204-44e8-8a5e-9606ea9d4321"},{"cell_type":"markdown","source":"* *O++ Ionic Abundance*:","metadata":{},"id":"dffd28b1-a330-4110-9595-7d5223c1d8e7"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'o'\nion = 'iii' # O II\no_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\no_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\nwavelength=4613.68\no_ii_4614_flux = 0.009\nabund_o_ii = pyequib.calc_abund_o_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength, line_flux=o_ii_4614_flux,\n o_ii_rc_br=o_ii_rc_data_br,\n o_ii_rc_data=o_ii_rc_data,\n h_i_aeff_data=h_i_aeff_data)\nprint('N(O^2+)/N(H+):', abund_o_ii)","metadata":{"trusted":true},"execution_count":14,"outputs":[{"name":"stdout","text":"N(O^2+)/N(H+): 0.0018886331186585524\n","output_type":"stream"}],"id":"41b9754f-4eb6-44fc-ba42-60bb473f5680"},{"cell_type":"markdown","source":"* *Ne++ Ionic Abundance*:","metadata":{},"id":"2c70e690-d816-433c-aa94-3b0f1f9cfa9d"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'ne'\nion = 'iii' # Ne II\nne_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n\natom = 'h'\nion = 'ii' # H I\nh_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\nwavelength=3777.14\nne_ii_3777_flux = 0.056\nabund_ne_ii = pyequib.calc_abund_ne_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength, line_flux=ne_ii_3777_flux,\n ne_ii_rc_data=ne_ii_rc_data, h_i_aeff_data=h_i_aeff_data)\nprint('N(Ne^2+)/N(H+):', abund_ne_ii)","metadata":{"trusted":true},"execution_count":15,"outputs":[{"name":"stdout","text":"N(Ne^2+)/N(H+): 0.0004337685176508937\n","output_type":"stream"}],"id":"0dc472c0-3148-4707-a682-66a5a573fd42"},{"cell_type":"markdown","source":"* *He I Emissivity*:","metadata":{},"id":"ff2680f0-d7ef-42e0-9323-c12b2277ee23"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_he_i_file = os.path.join(base_dir,data_rc_dir, 'rc_he_ii_PFSD12.fits')\n\natom = 'he'\nion = 'ii' # He I\nhe_i_rc_data = atomneb.read_aeff_he_i_pfsd12(atom_rc_he_i_file, atom, ion)\n\nhe_i_aeff_data = he_i_rc_data['aeff'][0]\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nlinenum=10# 4471.50\nemiss_he_i = pyequib.calc_emiss_he_i_rl(temperature=temperature, density=density,\n linenum=linenum, he_i_aeff_data=he_i_aeff_data)\nprint('He I Emissivity:', emiss_he_i)","metadata":{"trusted":true},"execution_count":16,"outputs":[{"name":"stdout","text":"He I Emissivity: 6.382282998859986e-26\n","output_type":"stream"}],"id":"5e77575b-e714-4d8b-bb70-220ea1220b6b"},{"cell_type":"markdown","source":"* *He II Emissivity*:","metadata":{},"id":"4a375c36-8264-4690-9aa6-793180186264"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n\natom = 'he'\nion = 'iii' # He II\nhe_ii_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\nhe_ii_aeff_data = he_ii_rc_data['aeff'][0]\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nemiss_he_ii = pyequib.calc_emiss_he_ii_rl(temperature=temperature, density=density,\n he_ii_aeff_data=he_ii_aeff_data)\nprint('He II Emissivity:', emiss_he_ii)","metadata":{"trusted":true},"execution_count":17,"outputs":[{"name":"stdout","text":"He II Emissivity: 1.4989133899436318e-24\n","output_type":"stream"}],"id":"e9957716-95f8-436a-8390-6900374d28f5"},{"cell_type":"markdown","source":"* *C II Emissivity*:","metadata":{},"id":"6aca0fcf-8d06-4215-9f0a-4bae192b41de"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n\natom = 'c'\nion = 'iii' # C II\nc_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nwavelength=6151.43\nemiss_c_ii = pyequib.calc_emiss_c_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength, c_ii_rc_data=c_ii_rc_data)\nprint('C II Emissivity:', emiss_c_ii)","metadata":{"trusted":true},"execution_count":18,"outputs":[{"name":"stdout","text":"C II Emissivity: 5.47195076640689e-26\n","output_type":"stream"}],"id":"871ea806-ffdd-4f8d-8fb7-bb3628f352e2"},{"cell_type":"markdown","source":"* *C III Emissivity*:","metadata":{},"id":"a85f49f8-26d2-4416-9c25-118f62fa94ba"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport numpy as np\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\n\natom = 'c'\nion = 'iv' # C III\nc_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n\ntemperature=np.float64(10000.0)\ndensity=np.float64(5000.0)\nwavelength=4647.42\nemiss_c_iii = pyequib.calc_emiss_c_iii_rl(temperature=temperature, density=density,\n wavelength=wavelength,\n c_iii_rc_data=c_iii_rc_data)\nprint('C III Emissivity:', emiss_c_iii)","metadata":{"trusted":true},"execution_count":19,"outputs":[{"name":"stdout","text":"C III Emissivity: 7.574962718812007e-25\n","output_type":"stream"}],"id":"dde957e3-11a0-4a83-8f70-cd0e1fd11d82"},{"cell_type":"markdown","source":"* *N II Emissivity*:","metadata":{},"id":"f8d56401-b6ad-4ae4-bcf3-2c7d9f071470"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n\natom = 'n'\nion = 'iii' # N II\nn_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\nn_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n\nwavelength=4442.02\nemiss_n_ii = pyequib.calc_emiss_n_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength,\n n_ii_rc_br=n_ii_rc_data_br, n_ii_rc_data=n_ii_rc_data)\nprint('N II Emissivity:', emiss_n_ii)","metadata":{"trusted":true},"execution_count":20,"outputs":[{"name":"stdout","text":"N II Emissivity: 3.0397396537791826e-26\n","output_type":"stream"}],"id":"b4e78666-9bf3-439f-b5f1-1f42b58f845a"},{"cell_type":"markdown","source":"* *N III Emissivity*:","metadata":{},"id":"32ceb8d3-f5cd-4996-95a8-a5a594ff4923"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\n\natom = 'n'\nion = 'iv' # N III\nn_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n\nwavelength=4640.64\nemiss_n_iii = pyequib.calc_emiss_n_iii_rl(temperature=temperature, density=density,\n wavelength=wavelength, n_iii_rc_data=n_iii_rc_data)\nprint('N III Emissivity:', emiss_n_iii)","metadata":{"trusted":true},"execution_count":21,"outputs":[{"name":"stdout","text":"N III Emissivity: 4.7908640325371894e-24\n","output_type":"stream"}],"id":"7e1e2319-2a21-414f-9753-574479e6fcb9"},{"cell_type":"markdown","source":"* *O II Emissivity*:","metadata":{},"id":"66db907c-921e-41d1-bb70-973efc97fb5b"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n\natom = 'o'\nion = 'iii' # O II\no_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\no_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n\nwavelength=4613.68\nemiss_o_ii = pyequib.calc_emiss_o_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength,\n o_ii_rc_br=o_ii_rc_data_br, o_ii_rc_data=o_ii_rc_data)\nprint('O II Emissivity:', emiss_o_ii)","metadata":{"trusted":true},"execution_count":22,"outputs":[{"name":"stdout","text":"O II Emissivity: 5.904731882515095e-27\n","output_type":"stream"}],"id":"e6687088-14ba-4957-9923-5873a42896a4"},{"cell_type":"markdown","source":"* *Ne II Emissivity*:","metadata":{},"id":"f20fd634-8a3d-46b9-b0be-b61fa9e473c4"},{"cell_type":"code","source":"import pyequib\nimport atomneb\nimport os\nbase_dir = 'externals/atomneb'\ndata_rc_dir = os.path.join('atomic-data-rc')\natom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n\natom = 'ne'\nion = 'iii' # Ne II\nne_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n\nwavelength=3777.14\nemiss_ne_ii = pyequib.calc_emiss_ne_ii_rl(temperature=temperature, density=density,\n wavelength=wavelength, ne_ii_rc_data=ne_ii_rc_data)\nprint('Ne II Emissivity:', emiss_ne_ii)","metadata":{"trusted":true},"execution_count":23,"outputs":[{"name":"stdout","text":"Ne II Emissivity: 1.5996879473068298e-25\n","output_type":"stream"}],"id":"a7c9833d-64a6-44f2-af69-4911bbd2429f"},{"cell_type":"markdown","source":"**How to Use Reddening Unit**\n\n*Reddening Unit* has the API functions for estimating logarithmic extinctions at H-beta and dereddening observed fluxes based on reddening laws and extinctions. Here are some examples of using Reddening Unit:","metadata":{},"id":"b447a49d-76bc-4a66-a69b-939eb3461e04"},{"cell_type":"markdown","source":"* *Reddening Law Function*:","metadata":{},"id":"ad145ed7-ba15-4ad3-a663-da394c7426f3"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nr_v=3.1\nfl=pyequib.redlaw(wavelength, rv=r_v, ext_law='GAL')\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":24,"outputs":[{"name":"stdout","text":"fl(6563): -0.3201381565976844\n","output_type":"stream"}],"id":"59578c18-ed27-4d26-b397-a552264d6c21"},{"cell_type":"markdown","source":"* *Galactic Reddening Law Function based on Seaton (1979), Howarth (1983), & CCM (1983)*:","metadata":{},"id":"7ff5f44c-eed8-4a9f-8506-e668d23a8ffb"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nr_v=3.1\nfl=pyequib.redlaw_gal(wavelength, rv=r_v)\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":25,"outputs":[{"name":"stdout","text":"fl(6563): -0.3201381565976844\n","output_type":"stream"}],"id":"bf5cb124-d38b-4503-aad7-15f449c44a4a"},{"cell_type":"markdown","source":"* *Galactic Reddening Law Function based on Savage & Mathis (1979)*:","metadata":{},"id":"e25dc340-2e77-45fb-8018-1f762aaa4a78"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nfl=pyequib.redlaw_gal2(wavelength)\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":26,"outputs":[{"name":"stdout","text":"fl(6563): -0.30925981659432267\n","output_type":"stream"}],"id":"83f87472-48fc-4a47-96b3-8d547c5fde90"},{"cell_type":"markdown","source":"* *Reddening Law Function based on Cardelli, Clayton & Mathis (1989)*:","metadata":{},"id":"b8e8b845-eefc-427e-8ea6-a8b96c26e892"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nr_v=3.1\nfl=pyequib.redlaw_ccm(wavelength, rv=r_v)\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":27,"outputs":[{"name":"stdout","text":"fl(6563): -0.2975660854538702\n","output_type":"stream"}],"id":"25e1d30a-1e66-44cc-b7b0-d6ffc08aa0b4"},{"cell_type":"markdown","source":"* *Galactic Reddening Law Function based on Whitford (1958), Seaton (1977), & Kaler(1976)*:","metadata":{},"id":"6346d091-5db9-447f-a857-6817fbad3ea8"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nfl=pyequib.redlaw_jbk(wavelength)\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":28,"outputs":[{"name":"stdout","text":"fl(6563): -0.33113682767027275\n","output_type":"stream"}],"id":"23685570-8809-4bf3-bb60-383faf539f50"},{"cell_type":"markdown","source":"* *Reddening Law Function based on Fitzpatrick & Massa (1990), Fitzpatrick (1999), Misselt (1999)*:","metadata":{},"id":"a73cea5c-cf25-4a74-a4ec-38cfd2c1f591"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nr_v=3.1\nfmlaw='AVGLMC'\nfl=pyequib.redlaw_fm(wavelength, fmlaw=fmlaw, rv=r_v)\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":29,"outputs":[{"name":"stdout","text":"fl(6563): -0.35058512521450946\n","output_type":"stream"}],"id":"ba780ff4-3761-4614-88e1-919d9be7e2d4"},{"cell_type":"markdown","source":"* *Reddening Law Function for the Small Magellanic Cloud*:","metadata":{},"id":"2ed66d34-7bc4-4dab-a6f4-516ab323a1dd"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nfl=pyequib.redlaw_smc(wavelength)\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":30,"outputs":[{"name":"stdout","text":"fl(6563): -0.22659257687766543\n","output_type":"stream"}],"id":"274bd01a-13a0-440c-9ca6-987dc439cfde"},{"cell_type":"markdown","source":"* *Reddening Law Function for the Large Magellanic Cloud*:","metadata":{},"id":"af737c85-660c-4c6b-9d68-042fe7c60bf9"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nfl=pyequib.redlaw_lmc(wavelength)\nprint('fl(6563):', fl)","metadata":{"trusted":true},"execution_count":31,"outputs":[{"name":"stdout","text":"fl(6563): -0.30871190712873775\n","output_type":"stream"}],"id":"a616a0f5-b9b9-488a-b085-887b42867cea"},{"cell_type":"markdown","source":"* *Dereddening Absolute Flux*:","metadata":{},"id":"47dc49d1-1330-4ce0-b1b4-fbe089f71232"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nm_ext=1.0\nflux=1.0\next_law='GAL'\nr_v=3.1\nflux_deredden=pyequib.deredden_relflux(wavelength, flux, m_ext, ext_law=ext_law, rv=r_v)\nprint('dereddened flux(6563)', flux_deredden)","metadata":{"trusted":true},"execution_count":32,"outputs":[{"name":"stdout","text":"dereddened flux(6563) 0.4784778560150707\n","output_type":"stream"}],"id":"f758a0b2-9c1d-4fd8-8ed3-f494d859dfdf"},{"cell_type":"markdown","source":"* *Dereddening Relative Flux*:","metadata":{},"id":"a2721a53-11e1-4fb0-a884-ab7379d5b0b6"},{"cell_type":"code","source":"import pyequib\nwavelength=6563.0\nm_ext=1.0\nflux=1.0\next_law='GAL'\nr_v=3.1\nflux_deredden=pyequib.deredden_flux(wavelength, flux, m_ext, ext_law=ext_law, rv=r_v)\nprint('dereddened flux(6563)', flux_deredden)","metadata":{"trusted":true},"execution_count":33,"outputs":[{"name":"stdout","text":"dereddened flux(6563) 4.784778560150707\n","output_type":"stream"}],"id":"555d102d-5e41-4a53-ae25-f835005ed382"},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[],"id":"5961f196-2d9b-4b8b-96d4-f97f73310b51"}]} \ No newline at end of file