Commit 0d08d71f219029b03c5989ef133341ad00de7ef2
1 parent
27b31ef8
Revisit comments of cscripts
Showing
2 changed files
with
46 additions
and
20 deletions
cscripts/csphagen.py
| ... | ... | @@ -113,20 +113,30 @@ class csphagen(ctools.csobservation): |
| 113 | 113 | # Private methods |
| 114 | 114 | def _query_src_direction(self): |
| 115 | 115 | """ |
| 116 | - Set up the source direction parameter. | |
| 117 | - Query relevant parameters. | |
| 116 | + Set up the source direction parameter | |
| 118 | 117 | """ |
| 118 | + # Initialise source direction | |
| 119 | 119 | self._src_dir = gammalib.GSkyDir() |
| 120 | + | |
| 121 | + # Get coordinate systel | |
| 120 | 122 | coordsys = self['coordsys'].string() |
| 123 | + | |
| 124 | + # If coordinate system is celestial then query "ra" and "dec" | |
| 121 | 125 | if coordsys == 'CEL': |
| 122 | 126 | ra = self['ra'].real() |
| 123 | 127 | dec = self['dec'].real() |
| 124 | 128 | self._src_dir.radec_deg(ra, dec) |
| 129 | + | |
| 130 | + # ... otherwise, if coordinate system is galactic then query "glon" | |
| 131 | + # and "glat" | |
| 125 | 132 | elif coordsys == 'GAL': |
| 126 | 133 | glon = self['glon'].real() |
| 127 | 134 | glat = self['glat'].real() |
| 128 | 135 | self._src_dir.lb_deg(glon, glat) |
| 129 | 136 | |
| 137 | + # Return | |
| 138 | + return | |
| 139 | + | |
| 130 | 140 | def _get_parameters_bkgmethod_reflected(self): |
| 131 | 141 | """ |
| 132 | 142 | Get parameters for REFLECTED background method |
| ... | ... | @@ -439,11 +449,16 @@ class csphagen(ctools.csobservation): |
| 439 | 449 | """ |
| 440 | 450 | Generate On/Off spectra for individual observation |
| 441 | 451 | |
| 442 | - :param i: int, observation number | |
| 443 | - :return: dictionary | |
| 444 | - On/Off spectra, background regions, observation id | |
| 445 | - """ | |
| 452 | + Parameters | |
| 453 | + ---------- | |
| 454 | + i : int | |
| 455 | + Observation number | |
| 446 | 456 | |
| 457 | + Returns | |
| 458 | + ------- | |
| 459 | + result : dict | |
| 460 | + On/Off spectra, background regions, observation id | |
| 461 | + """ | |
| 447 | 462 | # Retrieve observation from container |
| 448 | 463 | obs = self.obs()[i] |
| 449 | 464 | |
| ... | ... | @@ -486,17 +501,22 @@ class csphagen(ctools.csobservation): |
| 486 | 501 | # Return results |
| 487 | 502 | return result |
| 488 | 503 | |
| 489 | - def _unpack_result(self,outobs,result): | |
| 504 | + def _unpack_result(self, outobs, result): | |
| 490 | 505 | """ |
| 491 | - Unpack result from calculation of On/Off regions and appends it to observation | |
| 492 | - container. | |
| 506 | + Unpack result from calculation of On/Off regions | |
| 493 | 507 | |
| 494 | - :param outobs: `~gammalib.GObservations`, observation container | |
| 495 | - :param result: dict, result to unpack | |
| 496 | - :return: `~gammalib.GObservations` | |
| 497 | - observation container with result appended | |
| 498 | - """ | |
| 508 | + Parameters | |
| 509 | + ---------- | |
| 510 | + outobs : `~gammalib.GObservations` | |
| 511 | + Observation container | |
| 512 | + result : dict | |
| 513 | + On/Off spectra, background regions, observation id | |
| 499 | 514 | |
| 515 | + Returns | |
| 516 | + ------- | |
| 517 | + outobs : `~gammalib.GObservations` | |
| 518 | + Observation container with result appended | |
| 519 | + """ | |
| 500 | 520 | # If the results contain an On/Off observation |
| 501 | 521 | if result['onoff'].classname() == 'GCTAOnOffObservation': |
| 502 | 522 | # Append observation to observation container | ... | ... |
cscripts/cssens.py
| ... | ... | @@ -617,15 +617,20 @@ class cssens(ctools.csobservation): |
| 617 | 617 | # Return |
| 618 | 618 | return (crab_flux_prediction, regcoeff) |
| 619 | 619 | |
| 620 | - | |
| 621 | - def _e_bin(self,ieng): | |
| 620 | + def _e_bin(self, ieng): | |
| 622 | 621 | """ |
| 623 | - Determines sensivity in energy bin ieng | |
| 624 | - :param ieng: int, energy bin number | |
| 625 | - :return: dict, | |
| 622 | + Determines sensivity in energy bin | |
| 623 | + | |
| 624 | + Parameters | |
| 625 | + ---------- | |
| 626 | + ieng : int | |
| 627 | + Energy bin number | |
| 628 | + | |
| 629 | + Returns | |
| 630 | + ------- | |
| 631 | + result : dict | |
| 626 | 632 | Result dictionary |
| 627 | 633 | """ |
| 628 | - | |
| 629 | 634 | # Get sensitivity type |
| 630 | 635 | sensitivity_type = self['type'].string() |
| 631 | 636 | |
| ... | ... | @@ -648,6 +653,7 @@ class cssens(ctools.csobservation): |
| 648 | 653 | # Return results |
| 649 | 654 | return result |
| 650 | 655 | |
| 656 | + | |
| 651 | 657 | # Public methods |
| 652 | 658 | def run(self): |
| 653 | 659 | """ | ... | ... |