EmisGrid
EmisGrid
Bases: object
Instantiates an atom and compute the emissivities of all the atom lines for the (tem, den) values of a regularly spaced grid. Each line is represented in a 2D array, and there are as many arrays as transitions in the atom. The results can be saved for a later use in a cPickle file.
Source code in pyneb/core/emisGrid.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
__init__(elem=None, spec=None, n_tem=100, n_den=100, tem_min=5000.0, tem_max=20000.0, den_min=10.0, den_max=100000000.0, restore_file=None, atomObj=None, NLevels=None, **kwargs)
Container for the emission line intensity grids depending on Te and Ne.
Usage:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elem |
element (e.g. 'O') |
None
|
|
spec |
spectrum (e.g. 3) |
None
|
|
n_tem |
number of points of the electron temperature sample |
100
|
|
n_den |
number of points of the electron density sample |
100
|
|
tem_min |
minimum limit for the electron temperature |
5000.0
|
|
tem_max |
maximum limit for the electron temperature |
20000.0
|
|
den_min |
minimum limit for the electron density |
10.0
|
|
den_max |
maximum limit for the electron density |
100000000.0
|
|
restore_file |
if set, the emissivities are loaded from this file, otherwise (None) it is computed If the tem or den table from the restored file does not match the given parameters, a new grid is computed and self.compute_new_grid is set to True. The same applies if the atomic data are not the same. |
None
|
|
atomObj |
an atom object. In this case, no need for elem and spec. |
None
|
Usage:
O3map = pn.EmisGrid('O', 3, n_tem=30, n_den=30)
O3map = pn.EmisGrid(restore_file='plot/O3_10k.pypic') # Recovers the map from a previous computation
Source code in pyneb/core/emisGrid.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
getGrid(lev_i=None, lev_j=None, wave=-1, to_eval=None, label=None)
2D array of a line emissivity (erg.s-1.cm3) for the (Te, Ne) values of a regularly spaced grid. The line is specified either as the wavelength or the levels. An expression can also be used, for example to_eval = 'L(5007)/L(4959)'
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lev_i |
level i for the emission line |
None
|
|
lev_j |
level j for the emission line |
None
|
|
wave |
wavelength |
-1
|
|
to_eval |
algebraic expression of the line combination to evaluate |
None
|
Source code in pyneb/core/emisGrid.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
plotContours(to_eval, low_level=None, high_level=None, n_levels=20, levels=None, linestyles='-', clabels=True, log_levels=True, title=None, ax=None, **kwargs)
Plot a contour map of the diagnostic defined by to_eval.
Usage
O3map.plotContours('L(4363)/L(5007)')
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to_eval |
algebraic definition of the line ratio to contour-plot |
required | |
low_levels |
limit levels for the contour. If not set, the limit of the ratio values are used. |
required | |
high_levels |
limit levels for the contour. If not set, the limit of the ratio values are used. |
required | |
n_levels |
number of levels (20 is the default) |
20
|
|
linestyles |
used for the contour lines (default: solid line) |
'-'
|
|
clabels |
Boolean. Controls if line labels are printed (default: True) |
True
|
|
log_levels |
Boolean. If True (default), the log of the line ratio is used. |
True
|
|
title |
plot title |
None
|
|
**kwargs |
sent to plt.contour |
{}
|
Source code in pyneb/core/emisGrid.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
|
plotImage(to_eval=None, lev_i1=None, lev_j1=None, lev_i2=None, lev_j2=None, wave1=-1, wave2=-1, cblabel='', **kwargs)
Draw a contour plot of a line ratio. The contour is obtained by a horizontal cut in a temden-emissivity array. More elaborated plots can be obtained with the Diagnostic object.
Usage
O3map.plotImage('L(4363)/L(5007)') O3map.plotImage(wave1=4363, wave2=5007)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to_eval |
algebraic expression of the line combination to draw. May combine L(lambda) and I(i,j). |
None
|
|
lev_i1 |
levels of the a lines in case of simple line ratio plot. |
None
|
|
lev_i2 |
levels of the a lines in case of simple line ratio plot. |
None
|
|
lev_j1 |
levels of the a lines in case of simple line ratio plot. |
None
|
|
lev_j2 |
levels of the a lines in case of simple line ratio plot. |
None
|
|
wave1 |
wavelengths of the two lines in case of simple line ratio plot. |
-1
|
|
wave2 |
wavelengths of the two lines in case of simple line ratio plot. |
-1
|
|
cblabel |
a title for the colorbar |
''
|
|
**kwargs |
any other parameter will be sent to contourf and pcolor |
{}
|
Source code in pyneb/core/emisGrid.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
plotLineRatio(to_eval, par=None, par_low=None, par_high=None, n_par=10, linestyles='-', title=None, legend=True, loc=2, **kwargs)
Plot the diagnostic defined by to_eval as a function of either Ne or Te, with the other variable as a parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to_eval |
algebraic definition of the line ratio to contour-plot |
required | |
par |
quantity to be used as a parameter (either 'den' or 'tem') |
None
|
|
par_low |
lowest limit of the parameter range |
None
|
|
par_high |
highest limit of the parameter range |
None
|
|
n_par |
number of parameter's values (default: 10) |
10
|
|
linestyles |
used for the contour lines (default: solid) |
'-'
|
|
title |
plot title |
None
|
|
legend |
Boolean. If True, write legend title (default: True) |
True
|
|
**kwargs |
sent to plt.contour |
{}
|
Usage:
o3grid.plotLineRatio('L(4363)/L(5007)', par='den')
s2grid.plotLineRatio('I(2,1)/I(3,1)', par='tem', par_low=5000, par_high=20000, n_par=4)
Source code in pyneb/core/emisGrid.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
save(file_)
Save results for a later use.
Usage
O3map.save('plot/O3_30by30.pypic')
Parameter
file_ the name of the file in which the emissivity grids are stored
Source code in pyneb/core/emisGrid.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
getEmisGridDict(elem_list=None, spec_list=None, atom_list=None, restore=True, pypic_path=None, n_tem=100, n_den=100, tem_min=5000.0, tem_max=20000.0, den_min=10.0, den_max=100000000.0, save=True, atomDict=None, createPypicsDir=True, computeIfAbsent=True)
Return a dictionary of EmisGrid objects referred to by their atom string (e.g. 'O3').
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elem_list |
list of elements |
None
|
|
spec_list |
list of spectrum values (integers) |
None
|
|
atom_list |
list of atoms (e.g. ['N2', 'O3']) |
None
|
|
restore |
Boolean. If True (default), the program will search for a previously computed grid. If not found, it will compute the EmisGrid (unless computeIfAbsent is set to False) |
True
|
|
pypic_path |
directory where to look for the pypic emissivity files. It defaults to pn.config.pypic_path, which is defined when the PyNeb session begins and corresponds to $HOME/.pypics if the ENVIRONMENT variable HOME is accessible or to /tmp/pypics otherwise |
None
|
|
n_tem |
number of points in the Te samples resp. |
100
|
|
n_den |
number of points in the Ne samples resp. |
100
|
|
tem_min |
minimum Te value |
5000.0
|
|
tem_max |
maximum Te value |
20000.0
|
|
den_min |
minimum Ne value |
10.0
|
|
den_max |
maximum Ne value |
100000000.0
|
|
save |
bool
|
If True (default), the emissivity grid will be saved. It has no effect if the EmisGrid has just been restored. |
True
|
atomDict |
dictionary of Atom objects |
None
|
|
computeIfAbsent |
bool
|
If the file to restore is absent and this parameter is True, the EmisGrid is computed |
True
|
Usage:
emisgrids = pn.getEmisGridDict(['C', 'N', 'O'], [2, 3], save=True)
emisgrids = pn.getEmisGridDict(atom_list=['N2', 'O2', 'O3'], pypic_path='/tmp/pypics/',
den_max = 1e6)
emisgrids = pn.getEmisGridDict(atomDict=diags.atomDict)
Source code in pyneb/core/emisGrid.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
|