Best Python code snippet using autotest_python
rpcerrorlist.py
Source:rpcerrorlist.py  
2class AboutTooLongError(BadRequestError):3    def __init__(self, request):4        self.request = request5        super(Exception, self).__init__('The provided bio is too long' + self._fmt_request(self.request))6    def __reduce__(self):7        return type(self), (self.request,)8class AccessTokenExpiredError(BadRequestError):9    def __init__(self, request):10        self.request = request11        super(Exception, self).__init__('Bot token expired' + self._fmt_request(self.request))12    def __reduce__(self):13        return type(self), (self.request,)14class AccessTokenInvalidError(BadRequestError):15    def __init__(self, request):16        self.request = request17        super(Exception, self).__init__('The provided token is not valid' + self._fmt_request(self.request))18    def __reduce__(self):19        return type(self), (self.request,)20class ActiveUserRequiredError(UnauthorizedError):21    def __init__(self, request):22        self.request = request23        super(Exception, self).__init__('The method is only available to already activated users' + self._fmt_request(self.request))24    def __reduce__(self):25        return type(self), (self.request,)26class AdminsTooMuchError(BadRequestError):27    def __init__(self, request):28        self.request = request29        super(Exception, self).__init__('Too many admins' + self._fmt_request(self.request))30    def __reduce__(self):31        return type(self), (self.request,)32class AdminRankEmojiNotAllowedError(BadRequestError):33    def __init__(self, request):34        self.request = request35        super(Exception, self).__init__('Emoji are not allowed in admin titles or ranks' + self._fmt_request(self.request))36    def __reduce__(self):37        return type(self), (self.request,)38class AdminRankInvalidError(BadRequestError):39    def __init__(self, request):40        self.request = request41        super(Exception, self).__init__('The given admin title or rank was invalid (possibly larger than 16 characters)' + self._fmt_request(self.request))42    def __reduce__(self):43        return type(self), (self.request,)44class ApiIdInvalidError(BadRequestError):45    def __init__(self, request):46        self.request = request47        super(Exception, self).__init__('The api_id/api_hash combination is invalid' + self._fmt_request(self.request))48    def __reduce__(self):49        return type(self), (self.request,)50class ApiIdPublishedFloodError(BadRequestError):51    def __init__(self, request):52        self.request = request53        super(Exception, self).__init__("This API id was published somewhere, you can't use it now" + self._fmt_request(self.request))54    def __reduce__(self):55        return type(self), (self.request,)56class ArticleTitleEmptyError(BadRequestError):57    def __init__(self, request):58        self.request = request59        super(Exception, self).__init__('The title of the article is empty' + self._fmt_request(self.request))60    def __reduce__(self):61        return type(self), (self.request,)62class AuthBytesInvalidError(BadRequestError):63    def __init__(self, request):64        self.request = request65        super(Exception, self).__init__('The provided authorization is invalid' + self._fmt_request(self.request))66    def __reduce__(self):67        return type(self), (self.request,)68class AuthKeyDuplicatedError(AuthKeyError):69    def __init__(self, request):70        self.request = request71        super(Exception, self).__init__('The authorization key (session file) was used under two different IP addresses simultaneously, and can no longer be used. Use the same session exclusively, or use different sessions' + self._fmt_request(self.request))72    def __reduce__(self):73        return type(self), (self.request,)74class AuthKeyInvalidError(UnauthorizedError):75    def __init__(self, request):76        self.request = request77        super(Exception, self).__init__('The key is invalid' + self._fmt_request(self.request))78    def __reduce__(self):79        return type(self), (self.request,)80class AuthKeyPermEmptyError(UnauthorizedError):81    def __init__(self, request):82        self.request = request83        super(Exception, self).__init__('The method is unavailable for temporary authorization key, not bound to permanent' + self._fmt_request(self.request))84    def __reduce__(self):85        return type(self), (self.request,)86class AuthKeyUnregisteredError(UnauthorizedError):87    def __init__(self, request):88        self.request = request89        super(Exception, self).__init__('The key is not registered in the system' + self._fmt_request(self.request))90    def __reduce__(self):91        return type(self), (self.request,)92class AuthRestartError(ServerError):93    def __init__(self, request):94        self.request = request95        super(Exception, self).__init__('Restart the authorization process' + self._fmt_request(self.request))96    def __reduce__(self):97        return type(self), (self.request,)98class AuthTokenAlreadyAcceptedError(BadRequestError):99    def __init__(self, request):100        self.request = request101        super(Exception, self).__init__('The authorization token was already used' + self._fmt_request(self.request))102    def __reduce__(self):103        return type(self), (self.request,)104class AuthTokenExpiredError(BadRequestError):105    def __init__(self, request):106        self.request = request107        super(Exception, self).__init__('The provided authorization token has expired and the updated QR-code must be re-scanned' + self._fmt_request(self.request))108    def __reduce__(self):109        return type(self), (self.request,)110class AuthTokenInvalidError(BadRequestError):111    def __init__(self, request):112        self.request = request113        super(Exception, self).__init__('An invalid authorization token was provided' + self._fmt_request(self.request))114    def __reduce__(self):115        return type(self), (self.request,)116class BannedRightsInvalidError(BadRequestError):117    def __init__(self, request):118        self.request = request119        super(Exception, self).__init__('You cannot use that set of permissions in this request, i.e. restricting view_messages as a default' + self._fmt_request(self.request))120    def __reduce__(self):121        return type(self), (self.request,)122class BotsTooMuchError(BadRequestError):123    def __init__(self, request):124        self.request = request125        super(Exception, self).__init__('There are too many bots in this chat/channel' + self._fmt_request(self.request))126    def __reduce__(self):127        return type(self), (self.request,)128class BotChannelsNaError(BadRequestError):129    def __init__(self, request):130        self.request = request131        super(Exception, self).__init__("Bots can't edit admin privileges" + self._fmt_request(self.request))132    def __reduce__(self):133        return type(self), (self.request,)134class BotCommandDescriptionInvalidError(BadRequestError):135    def __init__(self, request):136        self.request = request137        super(Exception, self).__init__('The command description was empty, too long or had invalid characters used' + self._fmt_request(self.request))138    def __reduce__(self):139        return type(self), (self.request,)140class BotGroupsBlockedError(BadRequestError):141    def __init__(self, request):142        self.request = request143        super(Exception, self).__init__("This bot can't be added to groups" + self._fmt_request(self.request))144    def __reduce__(self):145        return type(self), (self.request,)146class BotInlineDisabledError(BadRequestError):147    def __init__(self, request):148        self.request = request149        super(Exception, self).__init__("This bot can't be used in inline mode" + self._fmt_request(self.request))150    def __reduce__(self):151        return type(self), (self.request,)152class BotInvalidError(BadRequestError):153    def __init__(self, request):154        self.request = request155        super(Exception, self).__init__('This is not a valid bot' + self._fmt_request(self.request))156    def __reduce__(self):157        return type(self), (self.request,)158class BotMethodInvalidError(BadRequestError):159    def __init__(self, request):160        self.request = request161        super(Exception, self).__init__('The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot' + self._fmt_request(self.request))162    def __reduce__(self):163        return type(self), (self.request,)164class BotMissingError(BadRequestError):165    def __init__(self, request):166        self.request = request167        super(Exception, self).__init__('This method can only be run by a bot' + self._fmt_request(self.request))168    def __reduce__(self):169        return type(self), (self.request,)170class BotPaymentsDisabledError(BadRequestError):171    def __init__(self, request):172        self.request = request173        super(Exception, self).__init__('This method can only be run by a bot' + self._fmt_request(self.request))174    def __reduce__(self):175        return type(self), (self.request,)176class BotPollsDisabledError(BadRequestError):177    def __init__(self, request):178        self.request = request179        super(Exception, self).__init__('You cannot create polls under a bot account' + self._fmt_request(self.request))180    def __reduce__(self):181        return type(self), (self.request,)182class BotResponseTimeoutError(BadRequestError):183    def __init__(self, request):184        self.request = request185        super(Exception, self).__init__('The bot did not answer to the callback query in time' + self._fmt_request(self.request))186    def __reduce__(self):187        return type(self), (self.request,)188class BroadcastForbiddenError(ForbiddenError):189    def __init__(self, request):190        self.request = request191        super(Exception, self).__init__('The request cannot be used in broadcast channels' + self._fmt_request(self.request))192    def __reduce__(self):193        return type(self), (self.request,)194class BroadcastIdInvalidError(BadRequestError):195    def __init__(self, request):196        self.request = request197        super(Exception, self).__init__('The channel is invalid' + self._fmt_request(self.request))198    def __reduce__(self):199        return type(self), (self.request,)200class BroadcastPublicVotersForbiddenError(BadRequestError):201    def __init__(self, request):202        self.request = request203        super(Exception, self).__init__('You cannot broadcast polls where the voters are public' + self._fmt_request(self.request))204    def __reduce__(self):205        return type(self), (self.request,)206class BroadcastRequiredError(BadRequestError):207    def __init__(self, request):208        self.request = request209        super(Exception, self).__init__('The request can only be used with a broadcast channel' + self._fmt_request(self.request))210    def __reduce__(self):211        return type(self), (self.request,)212class ButtonDataInvalidError(BadRequestError):213    def __init__(self, request):214        self.request = request215        super(Exception, self).__init__('The provided button data is invalid' + self._fmt_request(self.request))216    def __reduce__(self):217        return type(self), (self.request,)218class ButtonTypeInvalidError(BadRequestError):219    def __init__(self, request):220        self.request = request221        super(Exception, self).__init__('The type of one of the buttons you provided is invalid' + self._fmt_request(self.request))222    def __reduce__(self):223        return type(self), (self.request,)224class ButtonUrlInvalidError(BadRequestError):225    def __init__(self, request):226        self.request = request227        super(Exception, self).__init__('Button URL invalid' + self._fmt_request(self.request))228    def __reduce__(self):229        return type(self), (self.request,)230class CallAlreadyAcceptedError(BadRequestError):231    def __init__(self, request):232        self.request = request233        super(Exception, self).__init__('The call was already accepted' + self._fmt_request(self.request))234    def __reduce__(self):235        return type(self), (self.request,)236class CallAlreadyDeclinedError(BadRequestError):237    def __init__(self, request):238        self.request = request239        super(Exception, self).__init__('The call was already declined' + self._fmt_request(self.request))240    def __reduce__(self):241        return type(self), (self.request,)242class CallOccupyFailedError(ServerError):243    def __init__(self, request):244        self.request = request245        super(Exception, self).__init__('The call failed because the user is already making another call' + self._fmt_request(self.request))246    def __reduce__(self):247        return type(self), (self.request,)248class CallPeerInvalidError(BadRequestError):249    def __init__(self, request):250        self.request = request251        super(Exception, self).__init__('The provided call peer object is invalid' + self._fmt_request(self.request))252    def __reduce__(self):253        return type(self), (self.request,)254class CallProtocolFlagsInvalidError(BadRequestError):255    def __init__(self, request):256        self.request = request257        super(Exception, self).__init__('Call protocol flags invalid' + self._fmt_request(self.request))258    def __reduce__(self):259        return type(self), (self.request,)260class CdnMethodInvalidError(BadRequestError):261    def __init__(self, request):262        self.request = request263        super(Exception, self).__init__('This method cannot be invoked on a CDN server. Refer to https://core.telegram.org/cdn#schema for available methods' + self._fmt_request(self.request))264    def __reduce__(self):265        return type(self), (self.request,)266class ChannelsAdminPublicTooMuchError(BadRequestError):267    def __init__(self, request):268        self.request = request269        super(Exception, self).__init__("You're admin of too many public channels, make some channels private to change the username of this channel" + self._fmt_request(self.request))270    def __reduce__(self):271        return type(self), (self.request,)272class ChannelsTooMuchError(BadRequestError):273    def __init__(self, request):274        self.request = request275        super(Exception, self).__init__('You have joined too many channels/supergroups' + self._fmt_request(self.request))276    def __reduce__(self):277        return type(self), (self.request,)278class ChannelInvalidError(BadRequestError):279    def __init__(self, request):280        self.request = request281        super(Exception, self).__init__('Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited' + self._fmt_request(self.request))282    def __reduce__(self):283        return type(self), (self.request,)284class ChannelPrivateError(BadRequestError):285    def __init__(self, request):286        self.request = request287        super(Exception, self).__init__('The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it' + self._fmt_request(self.request))288    def __reduce__(self):289        return type(self), (self.request,)290class ChannelPublicGroupNaError(ForbiddenError):291    def __init__(self, request):292        self.request = request293        super(Exception, self).__init__('channel/supergroup not available' + self._fmt_request(self.request))294    def __reduce__(self):295        return type(self), (self.request,)296class ChatAboutNotModifiedError(BadRequestError):297    def __init__(self, request):298        self.request = request299        super(Exception, self).__init__('About text has not changed' + self._fmt_request(self.request))300    def __reduce__(self):301        return type(self), (self.request,)302class ChatAboutTooLongError(BadRequestError):303    def __init__(self, request):304        self.request = request305        super(Exception, self).__init__('Chat about too long' + self._fmt_request(self.request))306    def __reduce__(self):307        return type(self), (self.request,)308class ChatAdminInviteRequiredError(ForbiddenError):309    def __init__(self, request):310        self.request = request311        super(Exception, self).__init__('You do not have the rights to do this' + self._fmt_request(self.request))312    def __reduce__(self):313        return type(self), (self.request,)314class ChatAdminRequiredError(BadRequestError):315    def __init__(self, request):316        self.request = request317        super(Exception, self).__init__('Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group' + self._fmt_request(self.request))318    def __reduce__(self):319        return type(self), (self.request,)320class ChatForbiddenError(BadRequestError):321    def __init__(self, request):322        self.request = request323        super(Exception, self).__init__('You cannot write in this chat' + self._fmt_request(self.request))324    def __reduce__(self):325        return type(self), (self.request,)326class ChatIdEmptyError(BadRequestError):327    def __init__(self, request):328        self.request = request329        super(Exception, self).__init__('The provided chat ID is empty' + self._fmt_request(self.request))330    def __reduce__(self):331        return type(self), (self.request,)332class ChatIdInvalidError(BadRequestError):333    def __init__(self, request):334        self.request = request335        super(Exception, self).__init__('Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead' + self._fmt_request(self.request))336    def __reduce__(self):337        return type(self), (self.request,)338class ChatInvalidError(BadRequestError):339    def __init__(self, request):340        self.request = request341        super(Exception, self).__init__('The chat is invalid for this request' + self._fmt_request(self.request))342    def __reduce__(self):343        return type(self), (self.request,)344class ChatLinkExistsError(BadRequestError):345    def __init__(self, request):346        self.request = request347        super(Exception, self).__init__('The chat is linked to a channel and cannot be used in that request' + self._fmt_request(self.request))348    def __reduce__(self):349        return type(self), (self.request,)350class ChatNotModifiedError(BadRequestError):351    def __init__(self, request):352        self.request = request353        super(Exception, self).__init__("The chat or channel wasn't modified (title, invites, username, admins, etc. are the same)" + self._fmt_request(self.request))354    def __reduce__(self):355        return type(self), (self.request,)356class ChatRestrictedError(BadRequestError):357    def __init__(self, request):358        self.request = request359        super(Exception, self).__init__('The chat is restricted and cannot be used in that request' + self._fmt_request(self.request))360    def __reduce__(self):361        return type(self), (self.request,)362class ChatSendGifsForbiddenError(ForbiddenError):363    def __init__(self, request):364        self.request = request365        super(Exception, self).__init__("You can't send gifs in this chat" + self._fmt_request(self.request))366    def __reduce__(self):367        return type(self), (self.request,)368class ChatSendInlineForbiddenError(BadRequestError):369    def __init__(self, request):370        self.request = request371        super(Exception, self).__init__('You cannot send inline results in this chat' + self._fmt_request(self.request))372    def __reduce__(self):373        return type(self), (self.request,)374class ChatSendMediaForbiddenError(ForbiddenError):375    def __init__(self, request):376        self.request = request377        super(Exception, self).__init__("You can't send media in this chat" + self._fmt_request(self.request))378    def __reduce__(self):379        return type(self), (self.request,)380class ChatSendStickersForbiddenError(ForbiddenError):381    def __init__(self, request):382        self.request = request383        super(Exception, self).__init__("You can't send stickers in this chat" + self._fmt_request(self.request))384    def __reduce__(self):385        return type(self), (self.request,)386class ChatTitleEmptyError(BadRequestError):387    def __init__(self, request):388        self.request = request389        super(Exception, self).__init__('No chat title provided' + self._fmt_request(self.request))390    def __reduce__(self):391        return type(self), (self.request,)392class ChatWriteForbiddenError(ForbiddenError):393    def __init__(self, request):394        self.request = request395        super(Exception, self).__init__("You can't write in this chat" + self._fmt_request(self.request))396    def __reduce__(self):397        return type(self), (self.request,)398class CodeEmptyError(BadRequestError):399    def __init__(self, request):400        self.request = request401        super(Exception, self).__init__('The provided code is empty' + self._fmt_request(self.request))402    def __reduce__(self):403        return type(self), (self.request,)404class CodeHashInvalidError(BadRequestError):405    def __init__(self, request):406        self.request = request407        super(Exception, self).__init__('Code hash invalid' + self._fmt_request(self.request))408    def __reduce__(self):409        return type(self), (self.request,)410class CodeInvalidError(BadRequestError):411    def __init__(self, request):412        self.request = request413        super(Exception, self).__init__('Code invalid (i.e. from email)' + self._fmt_request(self.request))414    def __reduce__(self):415        return type(self), (self.request,)416class ConnectionApiIdInvalidError(BadRequestError):417    def __init__(self, request):418        self.request = request419        super(Exception, self).__init__('The provided API id is invalid' + self._fmt_request(self.request))420    def __reduce__(self):421        return type(self), (self.request,)422class ConnectionDeviceModelEmptyError(BadRequestError):423    def __init__(self, request):424        self.request = request425        super(Exception, self).__init__('Device model empty' + self._fmt_request(self.request))426    def __reduce__(self):427        return type(self), (self.request,)428class ConnectionLangPackInvalidError(BadRequestError):429    def __init__(self, request):430        self.request = request431        super(Exception, self).__init__('The specified language pack is not valid. This is meant to be used by official applications only so far, leave it empty' + self._fmt_request(self.request))432    def __reduce__(self):433        return type(self), (self.request,)434class ConnectionLayerInvalidError(BadRequestError):435    def __init__(self, request):436        self.request = request437        super(Exception, self).__init__('The very first request must always be InvokeWithLayerRequest' + self._fmt_request(self.request))438    def __reduce__(self):439        return type(self), (self.request,)440class ConnectionNotInitedError(BadRequestError):441    def __init__(self, request):442        self.request = request443        super(Exception, self).__init__('Connection not initialized' + self._fmt_request(self.request))444    def __reduce__(self):445        return type(self), (self.request,)446class ConnectionSystemEmptyError(BadRequestError):447    def __init__(self, request):448        self.request = request449        super(Exception, self).__init__('Connection system empty' + self._fmt_request(self.request))450    def __reduce__(self):451        return type(self), (self.request,)452class ConnectionSystemLangCodeEmptyError(BadRequestError):453    def __init__(self, request):454        self.request = request455        super(Exception, self).__init__('The system language string was empty during connection' + self._fmt_request(self.request))456    def __reduce__(self):457        return type(self), (self.request,)458class ContactIdInvalidError(BadRequestError):459    def __init__(self, request):460        self.request = request461        super(Exception, self).__init__('The provided contact ID is invalid' + self._fmt_request(self.request))462    def __reduce__(self):463        return type(self), (self.request,)464class ContactNameEmptyError(BadRequestError):465    def __init__(self, request):466        self.request = request467        super(Exception, self).__init__('The provided contact name cannot be empty' + self._fmt_request(self.request))468    def __reduce__(self):469        return type(self), (self.request,)470class DataInvalidError(BadRequestError):471    def __init__(self, request):472        self.request = request473        super(Exception, self).__init__('Encrypted data invalid' + self._fmt_request(self.request))474    def __reduce__(self):475        return type(self), (self.request,)476class DataJsonInvalidError(BadRequestError):477    def __init__(self, request):478        self.request = request479        super(Exception, self).__init__('The provided JSON data is invalid' + self._fmt_request(self.request))480    def __reduce__(self):481        return type(self), (self.request,)482class DateEmptyError(BadRequestError):483    def __init__(self, request):484        self.request = request485        super(Exception, self).__init__('Date empty' + self._fmt_request(self.request))486    def __reduce__(self):487        return type(self), (self.request,)488class DcIdInvalidError(BadRequestError):489    def __init__(self, request):490        self.request = request491        super(Exception, self).__init__('This occurs when an authorization is tried to be exported for the same data center one is currently connected to' + self._fmt_request(self.request))492    def __reduce__(self):493        return type(self), (self.request,)494class DhGAInvalidError(BadRequestError):495    def __init__(self, request):496        self.request = request497        super(Exception, self).__init__('g_a invalid' + self._fmt_request(self.request))498    def __reduce__(self):499        return type(self), (self.request,)500class EmailHashExpiredError(BadRequestError):501    def __init__(self, request):502        self.request = request503        super(Exception, self).__init__('The email hash expired and cannot be used to verify it' + self._fmt_request(self.request))504    def __reduce__(self):505        return type(self), (self.request,)506class EmailInvalidError(BadRequestError):507    def __init__(self, request):508        self.request = request509        super(Exception, self).__init__('The given email is invalid' + self._fmt_request(self.request))510    def __reduce__(self):511        return type(self), (self.request,)512class EmailUnconfirmedError(BadRequestError):513    def __init__(self, request, capture=0):514        self.request = request515        self.code_length = int(capture)516        super(Exception, self).__init__('Email unconfirmed, the length of the code must be {code_length}'.format(code_length=self.code_length) + self._fmt_request(self.request))517    def __reduce__(self):518        return type(self), (self.request, self.code_length)519class EmoticonEmptyError(BadRequestError):520    def __init__(self, request):521        self.request = request522        super(Exception, self).__init__('The emoticon field cannot be empty' + self._fmt_request(self.request))523    def __reduce__(self):524        return type(self), (self.request,)525class EmoticonInvalidError(BadRequestError):526    def __init__(self, request):527        self.request = request528        super(Exception, self).__init__('The specified emoticon cannot be used or was not a emoticon' + self._fmt_request(self.request))529    def __reduce__(self):530        return type(self), (self.request,)531class EncryptedMessageInvalidError(BadRequestError):532    def __init__(self, request):533        self.request = request534        super(Exception, self).__init__('Encrypted message invalid' + self._fmt_request(self.request))535    def __reduce__(self):536        return type(self), (self.request,)537class EncryptionAlreadyAcceptedError(BadRequestError):538    def __init__(self, request):539        self.request = request540        super(Exception, self).__init__('Secret chat already accepted' + self._fmt_request(self.request))541    def __reduce__(self):542        return type(self), (self.request,)543class EncryptionAlreadyDeclinedError(BadRequestError):544    def __init__(self, request):545        self.request = request546        super(Exception, self).__init__('The secret chat was already declined' + self._fmt_request(self.request))547    def __reduce__(self):548        return type(self), (self.request,)549class EncryptionDeclinedError(BadRequestError):550    def __init__(self, request):551        self.request = request552        super(Exception, self).__init__('The secret chat was declined' + self._fmt_request(self.request))553    def __reduce__(self):554        return type(self), (self.request,)555class EncryptionIdInvalidError(BadRequestError):556    def __init__(self, request):557        self.request = request558        super(Exception, self).__init__('The provided secret chat ID is invalid' + self._fmt_request(self.request))559    def __reduce__(self):560        return type(self), (self.request,)561class EncryptionOccupyFailedError(ServerError):562    def __init__(self, request):563        self.request = request564        super(Exception, self).__init__('TDLib developer claimed it is not an error while accepting secret chats and 500 is used instead of 420' + self._fmt_request(self.request))565    def __reduce__(self):566        return type(self), (self.request,)567class EntitiesTooLongError(BadRequestError):568    def __init__(self, request):569        self.request = request570        super(Exception, self).__init__('It is no longer possible to send such long data inside entity tags (for example inline text URLs)' + self._fmt_request(self.request))571    def __reduce__(self):572        return type(self), (self.request,)573class EntityMentionUserInvalidError(BadRequestError):574    def __init__(self, request):575        self.request = request576        super(Exception, self).__init__("You can't use this entity" + self._fmt_request(self.request))577    def __reduce__(self):578        return type(self), (self.request,)579class ErrorTextEmptyError(BadRequestError):580    def __init__(self, request):581        self.request = request582        super(Exception, self).__init__('The provided error message is empty' + self._fmt_request(self.request))583    def __reduce__(self):584        return type(self), (self.request,)585class ExportCardInvalidError(BadRequestError):586    def __init__(self, request):587        self.request = request588        super(Exception, self).__init__('Provided card is invalid' + self._fmt_request(self.request))589    def __reduce__(self):590        return type(self), (self.request,)591class ExternalUrlInvalidError(BadRequestError):592    def __init__(self, request):593        self.request = request594        super(Exception, self).__init__('External URL invalid' + self._fmt_request(self.request))595    def __reduce__(self):596        return type(self), (self.request,)597class FieldNameEmptyError(BadRequestError):598    def __init__(self, request):599        self.request = request600        super(Exception, self).__init__('The field with the name FIELD_NAME is missing' + self._fmt_request(self.request))601    def __reduce__(self):602        return type(self), (self.request,)603class FieldNameInvalidError(BadRequestError):604    def __init__(self, request):605        self.request = request606        super(Exception, self).__init__('The field with the name FIELD_NAME is invalid' + self._fmt_request(self.request))607    def __reduce__(self):608        return type(self), (self.request,)609class FileIdInvalidError(BadRequestError):610    def __init__(self, request):611        self.request = request612        super(Exception, self).__init__('The provided file id is invalid. Make sure all parameters are present, have the correct type and are not empty (ID, access hash, file reference, thumb size ...)' + self._fmt_request(self.request))613    def __reduce__(self):614        return type(self), (self.request,)615class FileMigrateError(InvalidDCError):616    def __init__(self, request, capture=0):617        self.request = request618        self.new_dc = int(capture)619        super(Exception, self).__init__('The file to be accessed is currently stored in DC {new_dc}'.format(new_dc=self.new_dc) + self._fmt_request(self.request))620    def __reduce__(self):621        return type(self), (self.request, self.new_dc)622class FilePartsInvalidError(BadRequestError):623    def __init__(self, request):624        self.request = request625        super(Exception, self).__init__('The number of file parts is invalid' + self._fmt_request(self.request))626    def __reduce__(self):627        return type(self), (self.request,)628class FilePart0MissingError(BadRequestError):629    def __init__(self, request):630        self.request = request631        super(Exception, self).__init__('File part 0 missing' + self._fmt_request(self.request))632    def __reduce__(self):633        return type(self), (self.request,)634class FilePartEmptyError(BadRequestError):635    def __init__(self, request):636        self.request = request637        super(Exception, self).__init__('The provided file part is empty' + self._fmt_request(self.request))638    def __reduce__(self):639        return type(self), (self.request,)640class FilePartInvalidError(BadRequestError):641    def __init__(self, request):642        self.request = request643        super(Exception, self).__init__('The file part number is invalid' + self._fmt_request(self.request))644    def __reduce__(self):645        return type(self), (self.request,)646class FilePartLengthInvalidError(BadRequestError):647    def __init__(self, request):648        self.request = request649        super(Exception, self).__init__('The length of a file part is invalid' + self._fmt_request(self.request))650    def __reduce__(self):651        return type(self), (self.request,)652class FilePartSizeChangedError(BadRequestError):653    def __init__(self, request):654        self.request = request655        super(Exception, self).__init__('The file part size (chunk size) cannot change during upload' + self._fmt_request(self.request))656    def __reduce__(self):657        return type(self), (self.request,)658class FilePartSizeInvalidError(BadRequestError):659    def __init__(self, request):660        self.request = request661        super(Exception, self).__init__('The provided file part size is invalid' + self._fmt_request(self.request))662    def __reduce__(self):663        return type(self), (self.request,)664class FilePartMissingError(BadRequestError):665    def __init__(self, request, capture=0):666        self.request = request667        self.which = int(capture)668        super(Exception, self).__init__('Part {which} of the file is missing from storage'.format(which=self.which) + self._fmt_request(self.request))669    def __reduce__(self):670        return type(self), (self.request, self.which)671class FileReferenceEmptyError(BadRequestError):672    def __init__(self, request):673        self.request = request674        super(Exception, self).__init__('The file reference must exist to access the media and it cannot be empty' + self._fmt_request(self.request))675    def __reduce__(self):676        return type(self), (self.request,)677class FileReferenceExpiredError(BadRequestError):678    def __init__(self, request):679        self.request = request680        super(Exception, self).__init__('The file reference has expired and is no longer valid or it belongs to self-destructing media and cannot be resent' + self._fmt_request(self.request))681    def __reduce__(self):682        return type(self), (self.request,)683class FilerefUpgradeNeededError(AuthKeyError):684    def __init__(self, request):685        self.request = request686        super(Exception, self).__init__('The file reference needs to be refreshed before being used again' + self._fmt_request(self.request))687    def __reduce__(self):688        return type(self), (self.request,)689class FirstNameInvalidError(BadRequestError):690    def __init__(self, request):691        self.request = request692        super(Exception, self).__init__('The first name is invalid' + self._fmt_request(self.request))693    def __reduce__(self):694        return type(self), (self.request,)695class FloodTestPhoneWaitError(FloodError):696    def __init__(self, request, capture=0):697        self.request = request698        self.seconds = int(capture)699        super(Exception, self).__init__('A wait of {seconds} seconds is required in the test servers'.format(seconds=self.seconds) + self._fmt_request(self.request))700    def __reduce__(self):701        return type(self), (self.request, self.seconds)702class FloodWaitError(FloodError):703    def __init__(self, request, capture=0):704        self.request = request705        self.seconds = int(capture)706        super(Exception, self).__init__('A wait of {seconds} seconds is required'.format(seconds=self.seconds) + self._fmt_request(self.request))707    def __reduce__(self):708        return type(self), (self.request, self.seconds)709class FolderIdEmptyError(BadRequestError):710    def __init__(self, request):711        self.request = request712        super(Exception, self).__init__('The folder you tried to delete was already empty' + self._fmt_request(self.request))713    def __reduce__(self):714        return type(self), (self.request,)715class FolderIdInvalidError(BadRequestError):716    def __init__(self, request):717        self.request = request718        super(Exception, self).__init__('The folder you tried to use was not valid' + self._fmt_request(self.request))719    def __reduce__(self):720        return type(self), (self.request,)721class FreshChangeAdminsForbiddenError(BadRequestError):722    def __init__(self, request):723        self.request = request724        super(Exception, self).__init__('Recently logged-in users cannot add or change admins' + self._fmt_request(self.request))725    def __reduce__(self):726        return type(self), (self.request,)727class FreshChangePhoneForbiddenError(AuthKeyError):728    def __init__(self, request):729        self.request = request730        super(Exception, self).__init__('Recently logged-in users cannot use this request' + self._fmt_request(self.request))731    def __reduce__(self):732        return type(self), (self.request,)733class FreshResetAuthorisationForbiddenError(AuthKeyError):734    def __init__(self, request):735        self.request = request736        super(Exception, self).__init__('The current session is too new and cannot be used to reset other authorisations yet' + self._fmt_request(self.request))737    def __reduce__(self):738        return type(self), (self.request,)739class GameBotInvalidError(BadRequestError):740    def __init__(self, request):741        self.request = request742        super(Exception, self).__init__('You cannot send that game with the current bot' + self._fmt_request(self.request))743    def __reduce__(self):744        return type(self), (self.request,)745class GifIdInvalidError(BadRequestError):746    def __init__(self, request):747        self.request = request748        super(Exception, self).__init__('The provided GIF ID is invalid' + self._fmt_request(self.request))749    def __reduce__(self):750        return type(self), (self.request,)751class GroupedMediaInvalidError(BadRequestError):752    def __init__(self, request):753        self.request = request754        super(Exception, self).__init__('Invalid grouped media' + self._fmt_request(self.request))755    def __reduce__(self):756        return type(self), (self.request,)757class HashInvalidError(BadRequestError):758    def __init__(self, request):759        self.request = request760        super(Exception, self).__init__('The provided hash is invalid' + self._fmt_request(self.request))761    def __reduce__(self):762        return type(self), (self.request,)763class HistoryGetFailedError(ServerError):764    def __init__(self, request):765        self.request = request766        super(Exception, self).__init__('Fetching of history failed' + self._fmt_request(self.request))767    def __reduce__(self):768        return type(self), (self.request,)769class ImageProcessFailedError(BadRequestError):770    def __init__(self, request):771        self.request = request772        super(Exception, self).__init__('Failure while processing image' + self._fmt_request(self.request))773    def __reduce__(self):774        return type(self), (self.request,)775class InlineBotRequiredError(ForbiddenError):776    def __init__(self, request):777        self.request = request778        super(Exception, self).__init__('The action must be performed through an inline bot callback' + self._fmt_request(self.request))779    def __reduce__(self):780        return type(self), (self.request,)781class InlineResultExpiredError(BadRequestError):782    def __init__(self, request):783        self.request = request784        super(Exception, self).__init__('The inline query expired' + self._fmt_request(self.request))785    def __reduce__(self):786        return type(self), (self.request,)787class InputConstructorInvalidError(BadRequestError):788    def __init__(self, request):789        self.request = request790        super(Exception, self).__init__('The provided constructor is invalid' + self._fmt_request(self.request))791    def __reduce__(self):792        return type(self), (self.request,)793class InputFetchErrorError(BadRequestError):794    def __init__(self, request):795        self.request = request796        super(Exception, self).__init__('An error occurred while deserializing TL parameters' + self._fmt_request(self.request))797    def __reduce__(self):798        return type(self), (self.request,)799class InputFetchFailError(BadRequestError):800    def __init__(self, request):801        self.request = request802        super(Exception, self).__init__('Failed deserializing TL payload' + self._fmt_request(self.request))803    def __reduce__(self):804        return type(self), (self.request,)805class InputLayerInvalidError(BadRequestError):806    def __init__(self, request):807        self.request = request808        super(Exception, self).__init__('The provided layer is invalid' + self._fmt_request(self.request))809    def __reduce__(self):810        return type(self), (self.request,)811class InputMethodInvalidError(BadRequestError):812    def __init__(self, request):813        self.request = request814        super(Exception, self).__init__('The invoked method does not exist anymore or has never existed' + self._fmt_request(self.request))815    def __reduce__(self):816        return type(self), (self.request,)817class InputRequestTooLongError(BadRequestError):818    def __init__(self, request):819        self.request = request820        super(Exception, self).__init__('The input request was too long. This may be a bug in the library as it can occur when serializing more bytes than it should (like appending the vector constructor code at the end of a message)' + self._fmt_request(self.request))821    def __reduce__(self):822        return type(self), (self.request,)823class InputUserDeactivatedError(BadRequestError):824    def __init__(self, request):825        self.request = request826        super(Exception, self).__init__('The specified user was deleted' + self._fmt_request(self.request))827    def __reduce__(self):828        return type(self), (self.request,)829class InterdcCallErrorError(BadRequestError):830    def __init__(self, request, capture=0):831        self.request = request832        self.dc = int(capture)833        super(Exception, self).__init__('An error occurred while communicating with DC {dc}'.format(dc=self.dc) + self._fmt_request(self.request))834    def __reduce__(self):835        return type(self), (self.request, self.dc)836class InterdcCallRichErrorError(BadRequestError):837    def __init__(self, request, capture=0):838        self.request = request839        self.dc = int(capture)840        super(Exception, self).__init__('A rich error occurred while communicating with DC {dc}'.format(dc=self.dc) + self._fmt_request(self.request))841    def __reduce__(self):842        return type(self), (self.request, self.dc)843class InviteHashEmptyError(BadRequestError):844    def __init__(self, request):845        self.request = request846        super(Exception, self).__init__('The invite hash is empty' + self._fmt_request(self.request))847    def __reduce__(self):848        return type(self), (self.request,)849class InviteHashExpiredError(BadRequestError):850    def __init__(self, request):851        self.request = request852        super(Exception, self).__init__('The chat the user tried to join has expired and is not valid anymore' + self._fmt_request(self.request))853    def __reduce__(self):854        return type(self), (self.request,)855class InviteHashInvalidError(BadRequestError):856    def __init__(self, request):857        self.request = request858        super(Exception, self).__init__('The invite hash is invalid' + self._fmt_request(self.request))859    def __reduce__(self):860        return type(self), (self.request,)861class LangPackInvalidError(BadRequestError):862    def __init__(self, request):863        self.request = request864        super(Exception, self).__init__('The provided language pack is invalid' + self._fmt_request(self.request))865    def __reduce__(self):866        return type(self), (self.request,)867class LastnameInvalidError(BadRequestError):868    def __init__(self, request):869        self.request = request870        super(Exception, self).__init__('The last name is invalid' + self._fmt_request(self.request))871    def __reduce__(self):872        return type(self), (self.request,)873class LimitInvalidError(BadRequestError):874    def __init__(self, request):875        self.request = request876        super(Exception, self).__init__('An invalid limit was provided. See https://core.telegram.org/api/files#downloading-files' + self._fmt_request(self.request))877    def __reduce__(self):878        return type(self), (self.request,)879class LinkNotModifiedError(BadRequestError):880    def __init__(self, request):881        self.request = request882        super(Exception, self).__init__('The channel is already linked to this group' + self._fmt_request(self.request))883    def __reduce__(self):884        return type(self), (self.request,)885class LocationInvalidError(BadRequestError):886    def __init__(self, request):887        self.request = request888        super(Exception, self).__init__('The location given for a file was invalid. See https://core.telegram.org/api/files#downloading-files' + self._fmt_request(self.request))889    def __reduce__(self):890        return type(self), (self.request,)891class MaxIdInvalidError(BadRequestError):892    def __init__(self, request):893        self.request = request894        super(Exception, self).__init__('The provided max ID is invalid' + self._fmt_request(self.request))895    def __reduce__(self):896        return type(self), (self.request,)897class MaxQtsInvalidError(BadRequestError):898    def __init__(self, request):899        self.request = request900        super(Exception, self).__init__('The provided QTS were invalid' + self._fmt_request(self.request))901    def __reduce__(self):902        return type(self), (self.request,)903class Md5ChecksumInvalidError(BadRequestError):904    def __init__(self, request):905        self.request = request906        super(Exception, self).__init__('The MD5 check-sums do not match' + self._fmt_request(self.request))907    def __reduce__(self):908        return type(self), (self.request,)909class MediaCaptionTooLongError(BadRequestError):910    def __init__(self, request):911        self.request = request912        super(Exception, self).__init__('The caption is too long' + self._fmt_request(self.request))913    def __reduce__(self):914        return type(self), (self.request,)915class MediaEmptyError(BadRequestError):916    def __init__(self, request):917        self.request = request918        super(Exception, self).__init__('The provided media object is invalid or the current account may not be able to send it (such as games as users)' + self._fmt_request(self.request))919    def __reduce__(self):920        return type(self), (self.request,)921class MediaInvalidError(BadRequestError):922    def __init__(self, request):923        self.request = request924        super(Exception, self).__init__('Media invalid' + self._fmt_request(self.request))925    def __reduce__(self):926        return type(self), (self.request,)927class MediaNewInvalidError(BadRequestError):928    def __init__(self, request):929        self.request = request930        super(Exception, self).__init__('The new media to edit the message with is invalid (such as stickers or voice notes)' + self._fmt_request(self.request))931    def __reduce__(self):932        return type(self), (self.request,)933class MediaPrevInvalidError(BadRequestError):934    def __init__(self, request):935        self.request = request936        super(Exception, self).__init__('The old media cannot be edited with anything else (such as stickers or voice notes)' + self._fmt_request(self.request))937    def __reduce__(self):938        return type(self), (self.request,)939class MegagroupIdInvalidError(BadRequestError):940    def __init__(self, request):941        self.request = request942        super(Exception, self).__init__('The group is invalid' + self._fmt_request(self.request))943    def __reduce__(self):944        return type(self), (self.request,)945class MegagroupPrehistoryHiddenError(BadRequestError):946    def __init__(self, request):947        self.request = request948        super(Exception, self).__init__("You can't set this discussion group because it's history is hidden" + self._fmt_request(self.request))949    def __reduce__(self):950        return type(self), (self.request,)951class MegagroupRequiredError(BadRequestError):952    def __init__(self, request):953        self.request = request954        super(Exception, self).__init__('The request can only be used with a megagroup channel' + self._fmt_request(self.request))955    def __reduce__(self):956        return type(self), (self.request,)957class MemberNoLocationError(ServerError):958    def __init__(self, request):959        self.request = request960        super(Exception, self).__init__("An internal failure occurred while fetching user info (couldn't find location)" + self._fmt_request(self.request))961    def __reduce__(self):962        return type(self), (self.request,)963class MemberOccupyPrimaryLocFailedError(ServerError):964    def __init__(self, request):965        self.request = request966        super(Exception, self).__init__('Occupation of primary member location failed' + self._fmt_request(self.request))967    def __reduce__(self):968        return type(self), (self.request,)969class MessageAuthorRequiredError(ForbiddenError):970    def __init__(self, request):971        self.request = request972        super(Exception, self).__init__('Message author required' + self._fmt_request(self.request))973    def __reduce__(self):974        return type(self), (self.request,)975class MessageDeleteForbiddenError(ForbiddenError):976    def __init__(self, request):977        self.request = request978        super(Exception, self).__init__("You can't delete one of the messages you tried to delete, most likely because it is a service message." + self._fmt_request(self.request))979    def __reduce__(self):980        return type(self), (self.request,)981class MessageEditTimeExpiredError(BadRequestError):982    def __init__(self, request):983        self.request = request984        super(Exception, self).__init__("You can't edit this message anymore, too much time has passed since its creation." + self._fmt_request(self.request))985    def __reduce__(self):986        return type(self), (self.request,)987class MessageEmptyError(BadRequestError):988    def __init__(self, request):989        self.request = request990        super(Exception, self).__init__('Empty or invalid UTF-8 message was sent' + self._fmt_request(self.request))991    def __reduce__(self):992        return type(self), (self.request,)993class MessageIdsEmptyError(BadRequestError):994    def __init__(self, request):995        self.request = request996        super(Exception, self).__init__('No message ids were provided' + self._fmt_request(self.request))997    def __reduce__(self):998        return type(self), (self.request,)999class MessageIdInvalidError(BadRequestError):1000    def __init__(self, request):1001        self.request = request1002        super(Exception, self).__init__("The specified message ID is invalid or you can't do that operation on such message" + self._fmt_request(self.request))1003    def __reduce__(self):1004        return type(self), (self.request,)1005class MessageNotModifiedError(BadRequestError):1006    def __init__(self, request):1007        self.request = request1008        super(Exception, self).__init__('Content of the message was not modified' + self._fmt_request(self.request))1009    def __reduce__(self):1010        return type(self), (self.request,)1011class MessagePollClosedError(BadRequestError):1012    def __init__(self, request):1013        self.request = request1014        super(Exception, self).__init__('The poll was closed and can no longer be voted on' + self._fmt_request(self.request))1015    def __reduce__(self):1016        return type(self), (self.request,)1017class MessageTooLongError(BadRequestError):1018    def __init__(self, request):1019        self.request = request1020        super(Exception, self).__init__('Message was too long. Current maximum length is 4096 UTF-8 characters' + self._fmt_request(self.request))1021    def __reduce__(self):1022        return type(self), (self.request,)1023class MethodInvalidError(BadRequestError):1024    def __init__(self, request):1025        self.request = request1026        super(Exception, self).__init__('The API method is invalid and cannot be used' + self._fmt_request(self.request))1027    def __reduce__(self):1028        return type(self), (self.request,)1029class MsgidDecreaseRetryError(ServerError):1030    def __init__(self, request):1031        self.request = request1032        super(Exception, self).__init__('The request should be retried with a lower message ID' + self._fmt_request(self.request))1033    def __reduce__(self):1034        return type(self), (self.request,)1035class MsgIdInvalidError(BadRequestError):1036    def __init__(self, request):1037        self.request = request1038        super(Exception, self).__init__('The message ID used in the peer was invalid' + self._fmt_request(self.request))1039    def __reduce__(self):1040        return type(self), (self.request,)1041class MsgWaitFailedError(BadRequestError):1042    def __init__(self, request):1043        self.request = request1044        super(Exception, self).__init__('A waiting call returned an error' + self._fmt_request(self.request))1045    def __reduce__(self):1046        return type(self), (self.request,)1047class MtSendQueueTooLongError(ServerError):1048    def __init__(self, request):1049        self.request = request1050        super(Exception, self).__init__('' + self._fmt_request(self.request))1051    def __reduce__(self):1052        return type(self), (self.request,)1053class NeedChatInvalidError(ServerError):1054    def __init__(self, request):1055        self.request = request1056        super(Exception, self).__init__('The provided chat is invalid' + self._fmt_request(self.request))1057    def __reduce__(self):1058        return type(self), (self.request,)1059class NeedMemberInvalidError(ServerError):1060    def __init__(self, request):1061        self.request = request1062        super(Exception, self).__init__('The provided member is invalid or does not exist (for example a thumb size)' + self._fmt_request(self.request))1063    def __reduce__(self):1064        return type(self), (self.request,)1065class NetworkMigrateError(InvalidDCError):1066    def __init__(self, request, capture=0):1067        self.request = request1068        self.new_dc = int(capture)1069        super(Exception, self).__init__('The source IP address is associated with DC {new_dc}'.format(new_dc=self.new_dc) + self._fmt_request(self.request))1070    def __reduce__(self):1071        return type(self), (self.request, self.new_dc)1072class NewSaltInvalidError(BadRequestError):1073    def __init__(self, request):1074        self.request = request1075        super(Exception, self).__init__('The new salt is invalid' + self._fmt_request(self.request))1076    def __reduce__(self):1077        return type(self), (self.request,)1078class NewSettingsInvalidError(BadRequestError):1079    def __init__(self, request):1080        self.request = request1081        super(Exception, self).__init__('The new settings are invalid' + self._fmt_request(self.request))1082    def __reduce__(self):1083        return type(self), (self.request,)1084class OffsetInvalidError(BadRequestError):1085    def __init__(self, request):1086        self.request = request1087        super(Exception, self).__init__('The given offset was invalid, it must be divisible by 1KB. See https://core.telegram.org/api/files#downloading-files' + self._fmt_request(self.request))1088    def __reduce__(self):1089        return type(self), (self.request,)1090class OffsetPeerIdInvalidError(BadRequestError):1091    def __init__(self, request):1092        self.request = request1093        super(Exception, self).__init__('The provided offset peer is invalid' + self._fmt_request(self.request))1094    def __reduce__(self):1095        return type(self), (self.request,)1096class OptionInvalidError(BadRequestError):1097    def __init__(self, request):1098        self.request = request1099        super(Exception, self).__init__('The option specified is invalid and does not exist in the target poll' + self._fmt_request(self.request))1100    def __reduce__(self):1101        return type(self), (self.request,)1102class OptionsTooMuchError(BadRequestError):1103    def __init__(self, request):1104        self.request = request1105        super(Exception, self).__init__('You defined too many options for the poll' + self._fmt_request(self.request))1106    def __reduce__(self):1107        return type(self), (self.request,)1108class PackShortNameInvalidError(BadRequestError):1109    def __init__(self, request):1110        self.request = request1111        super(Exception, self).__init__('Invalid sticker pack name. It must begin with a letter, can\'t contain consecutive underscores and must end in "_by_<bot username>".' + self._fmt_request(self.request))1112    def __reduce__(self):1113        return type(self), (self.request,)1114class PackShortNameOccupiedError(BadRequestError):1115    def __init__(self, request):1116        self.request = request1117        super(Exception, self).__init__('A stickerpack with this name already exists' + self._fmt_request(self.request))1118    def __reduce__(self):1119        return type(self), (self.request,)1120class ParticipantsTooFewError(BadRequestError):1121    def __init__(self, request):1122        self.request = request1123        super(Exception, self).__init__('Not enough participants' + self._fmt_request(self.request))1124    def __reduce__(self):1125        return type(self), (self.request,)1126class ParticipantCallFailedError(ServerError):1127    def __init__(self, request):1128        self.request = request1129        super(Exception, self).__init__('Failure while making call' + self._fmt_request(self.request))1130    def __reduce__(self):1131        return type(self), (self.request,)1132class ParticipantVersionOutdatedError(BadRequestError):1133    def __init__(self, request):1134        self.request = request1135        super(Exception, self).__init__('The other participant does not use an up to date telegram client with support for calls' + self._fmt_request(self.request))1136    def __reduce__(self):1137        return type(self), (self.request,)1138class PasswordEmptyError(BadRequestError):1139    def __init__(self, request):1140        self.request = request1141        super(Exception, self).__init__('The provided password is empty' + self._fmt_request(self.request))1142    def __reduce__(self):1143        return type(self), (self.request,)1144class PasswordHashInvalidError(BadRequestError):1145    def __init__(self, request):1146        self.request = request1147        super(Exception, self).__init__('The password (and thus its hash value) you entered is invalid' + self._fmt_request(self.request))1148    def __reduce__(self):1149        return type(self), (self.request,)1150class PasswordMissingError(BadRequestError):1151    def __init__(self, request):1152        self.request = request1153        super(Exception, self).__init__('The account must have 2-factor authentication enabled (a password) before this method can be used' + self._fmt_request(self.request))1154    def __reduce__(self):1155        return type(self), (self.request,)1156class PasswordRequiredError(BadRequestError):1157    def __init__(self, request):1158        self.request = request1159        super(Exception, self).__init__('The account must have 2-factor authentication enabled (a password) before this method can be used' + self._fmt_request(self.request))1160    def __reduce__(self):1161        return type(self), (self.request,)1162class PasswordTooFreshError(BadRequestError):1163    def __init__(self, request, capture=0):1164        self.request = request1165        self.seconds = int(capture)1166        super(Exception, self).__init__('The password was added too recently and {seconds} seconds must pass before using the method'.format(seconds=self.seconds) + self._fmt_request(self.request))1167    def __reduce__(self):1168        return type(self), (self.request, self.seconds)1169class PaymentProviderInvalidError(BadRequestError):1170    def __init__(self, request):1171        self.request = request1172        super(Exception, self).__init__('The payment provider was not recognised or its token was invalid' + self._fmt_request(self.request))1173    def __reduce__(self):1174        return type(self), (self.request,)1175class PeerFloodError(BadRequestError):1176    def __init__(self, request):1177        self.request = request1178        super(Exception, self).__init__('Too many requests' + self._fmt_request(self.request))1179    def __reduce__(self):1180        return type(self), (self.request,)1181class PeerIdInvalidError(BadRequestError):1182    def __init__(self, request):1183        self.request = request1184        super(Exception, self).__init__('An invalid Peer was used. Make sure to pass the right peer type' + self._fmt_request(self.request))1185    def __reduce__(self):1186        return type(self), (self.request,)1187class PeerIdNotSupportedError(BadRequestError):1188    def __init__(self, request):1189        self.request = request1190        super(Exception, self).__init__('The provided peer ID is not supported' + self._fmt_request(self.request))1191    def __reduce__(self):1192        return type(self), (self.request,)1193class PersistentTimestampEmptyError(BadRequestError):1194    def __init__(self, request):1195        self.request = request1196        super(Exception, self).__init__('Persistent timestamp empty' + self._fmt_request(self.request))1197    def __reduce__(self):1198        return type(self), (self.request,)1199class PersistentTimestampInvalidError(BadRequestError):1200    def __init__(self, request):1201        self.request = request1202        super(Exception, self).__init__('Persistent timestamp invalid' + self._fmt_request(self.request))1203    def __reduce__(self):1204        return type(self), (self.request,)1205class PersistentTimestampOutdatedError(ServerError):1206    def __init__(self, request):1207        self.request = request1208        super(Exception, self).__init__('Persistent timestamp outdated' + self._fmt_request(self.request))1209    def __reduce__(self):1210        return type(self), (self.request,)1211class PhoneCodeEmptyError(BadRequestError):1212    def __init__(self, request):1213        self.request = request1214        super(Exception, self).__init__('The phone code is missing' + self._fmt_request(self.request))1215    def __reduce__(self):1216        return type(self), (self.request,)1217class PhoneCodeExpiredError(BadRequestError):1218    def __init__(self, request):1219        self.request = request1220        super(Exception, self).__init__('The confirmation code has expired' + self._fmt_request(self.request))1221    def __reduce__(self):1222        return type(self), (self.request,)1223class PhoneCodeHashEmptyError(BadRequestError):1224    def __init__(self, request):1225        self.request = request1226        super(Exception, self).__init__('The phone code hash is missing' + self._fmt_request(self.request))1227    def __reduce__(self):1228        return type(self), (self.request,)1229class PhoneCodeInvalidError(BadRequestError):1230    def __init__(self, request):1231        self.request = request1232        super(Exception, self).__init__('The phone code entered was invalid' + self._fmt_request(self.request))1233    def __reduce__(self):1234        return type(self), (self.request,)1235class PhoneMigrateError(InvalidDCError):1236    def __init__(self, request, capture=0):1237        self.request = request1238        self.new_dc = int(capture)1239        super(Exception, self).__init__('The phone number a user is trying to use for authorization is associated with DC {new_dc}'.format(new_dc=self.new_dc) + self._fmt_request(self.request))1240    def __reduce__(self):1241        return type(self), (self.request, self.new_dc)1242class PhoneNumberAppSignupForbiddenError(BadRequestError):1243    def __init__(self, request):1244        self.request = request1245        super(Exception, self).__init__('' + self._fmt_request(self.request))1246    def __reduce__(self):1247        return type(self), (self.request,)1248class PhoneNumberBannedError(BadRequestError):1249    def __init__(self, request):1250        self.request = request1251        super(Exception, self).__init__('The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam' + self._fmt_request(self.request))1252    def __reduce__(self):1253        return type(self), (self.request,)1254class PhoneNumberFloodError(BadRequestError):1255    def __init__(self, request):1256        self.request = request1257        super(Exception, self).__init__('You asked for the code too many times.' + self._fmt_request(self.request))1258    def __reduce__(self):1259        return type(self), (self.request,)1260class PhoneNumberInvalidError(BadRequestError):1261    def __init__(self, request):1262        self.request = request1263        super(Exception, self).__init__('The phone number is invalid' + self._fmt_request(self.request))1264    def __reduce__(self):1265        return type(self), (self.request,)1266class PhoneNumberOccupiedError(BadRequestError):1267    def __init__(self, request):1268        self.request = request1269        super(Exception, self).__init__('The phone number is already in use' + self._fmt_request(self.request))1270    def __reduce__(self):1271        return type(self), (self.request,)1272class PhoneNumberUnoccupiedError(BadRequestError):1273    def __init__(self, request):1274        self.request = request1275        super(Exception, self).__init__('The phone number is not yet being used' + self._fmt_request(self.request))1276    def __reduce__(self):1277        return type(self), (self.request,)1278class PhonePasswordFloodError(AuthKeyError):1279    def __init__(self, request):1280        self.request = request1281        super(Exception, self).__init__('You have tried logging in too many times' + self._fmt_request(self.request))1282    def __reduce__(self):1283        return type(self), (self.request,)1284class PhonePasswordProtectedError(BadRequestError):1285    def __init__(self, request):1286        self.request = request1287        super(Exception, self).__init__('This phone is password protected' + self._fmt_request(self.request))1288    def __reduce__(self):1289        return type(self), (self.request,)1290class PhotoContentUrlEmptyError(BadRequestError):1291    def __init__(self, request):1292        self.request = request1293        super(Exception, self).__init__('The content from the URL used as a photo appears to be empty or has caused another HTTP error' + self._fmt_request(self.request))1294    def __reduce__(self):1295        return type(self), (self.request,)1296class PhotoCropSizeSmallError(BadRequestError):1297    def __init__(self, request):1298        self.request = request1299        super(Exception, self).__init__('Photo is too small' + self._fmt_request(self.request))1300    def __reduce__(self):1301        return type(self), (self.request,)1302class PhotoExtInvalidError(BadRequestError):1303    def __init__(self, request):1304        self.request = request1305        super(Exception, self).__init__('The extension of the photo is invalid' + self._fmt_request(self.request))1306    def __reduce__(self):1307        return type(self), (self.request,)1308class PhotoInvalidError(BadRequestError):1309    def __init__(self, request):1310        self.request = request1311        super(Exception, self).__init__('Photo invalid' + self._fmt_request(self.request))1312    def __reduce__(self):1313        return type(self), (self.request,)1314class PhotoInvalidDimensionsError(BadRequestError):1315    def __init__(self, request):1316        self.request = request1317        super(Exception, self).__init__('The photo dimensions are invalid (hint: `pip install pillow` for `send_file` to resize images)' + self._fmt_request(self.request))1318    def __reduce__(self):1319        return type(self), (self.request,)1320class PhotoSaveFileInvalidError(BadRequestError):1321    def __init__(self, request):1322        self.request = request1323        super(Exception, self).__init__('The photo you tried to send cannot be saved by Telegram. A reason may be that it exceeds 10MB. Try resizing it locally' + self._fmt_request(self.request))1324    def __reduce__(self):1325        return type(self), (self.request,)1326class PhotoThumbUrlEmptyError(BadRequestError):1327    def __init__(self, request):1328        self.request = request1329        super(Exception, self).__init__('The URL used as a thumbnail appears to be empty or has caused another HTTP error' + self._fmt_request(self.request))1330    def __reduce__(self):1331        return type(self), (self.request,)1332class PinRestrictedError(BadRequestError):1333    def __init__(self, request):1334        self.request = request1335        super(Exception, self).__init__("You can't pin messages in private chats with other people" + self._fmt_request(self.request))1336    def __reduce__(self):1337        return type(self), (self.request,)1338class PollAnswersInvalidError(BadRequestError):1339    def __init__(self, request):1340        self.request = request1341        super(Exception, self).__init__('The poll did not have enough answers or had too many' + self._fmt_request(self.request))1342    def __reduce__(self):1343        return type(self), (self.request,)1344class PollOptionDuplicateError(BadRequestError):1345    def __init__(self, request):1346        self.request = request1347        super(Exception, self).__init__('A duplicate option was sent in the same poll' + self._fmt_request(self.request))1348    def __reduce__(self):1349        return type(self), (self.request,)1350class PollOptionInvalidError(BadRequestError):1351    def __init__(self, request):1352        self.request = request1353        super(Exception, self).__init__('A poll option used invalid data (the data may be too long)' + self._fmt_request(self.request))1354    def __reduce__(self):1355        return type(self), (self.request,)1356class PollQuestionInvalidError(BadRequestError):1357    def __init__(self, request):1358        self.request = request1359        super(Exception, self).__init__('The poll question was either empty or too long' + self._fmt_request(self.request))1360    def __reduce__(self):1361        return type(self), (self.request,)1362class PollUnsupportedError(BadRequestError):1363    def __init__(self, request):1364        self.request = request1365        super(Exception, self).__init__('This layer does not support polls in the issued method' + self._fmt_request(self.request))1366    def __reduce__(self):1367        return type(self), (self.request,)1368class PrivacyKeyInvalidError(BadRequestError):1369    def __init__(self, request):1370        self.request = request1371        super(Exception, self).__init__('The privacy key is invalid' + self._fmt_request(self.request))1372    def __reduce__(self):1373        return type(self), (self.request,)1374class PrivacyTooLongError(BadRequestError):1375    def __init__(self, request):1376        self.request = request1377        super(Exception, self).__init__('Cannot add that many entities in a single request' + self._fmt_request(self.request))1378    def __reduce__(self):1379        return type(self), (self.request,)1380class PtsChangeEmptyError(ServerError):1381    def __init__(self, request):1382        self.request = request1383        super(Exception, self).__init__('No PTS change' + self._fmt_request(self.request))1384    def __reduce__(self):1385        return type(self), (self.request,)1386class QueryIdEmptyError(BadRequestError):1387    def __init__(self, request):1388        self.request = request1389        super(Exception, self).__init__('The query ID is empty' + self._fmt_request(self.request))1390    def __reduce__(self):1391        return type(self), (self.request,)1392class QueryIdInvalidError(BadRequestError):1393    def __init__(self, request):1394        self.request = request1395        super(Exception, self).__init__('The query ID is invalid' + self._fmt_request(self.request))1396    def __reduce__(self):1397        return type(self), (self.request,)1398class QueryTooShortError(BadRequestError):1399    def __init__(self, request):1400        self.request = request1401        super(Exception, self).__init__('The query string is too short' + self._fmt_request(self.request))1402    def __reduce__(self):1403        return type(self), (self.request,)1404class QuizCorrectAnswersEmptyError(BadRequestError):1405    def __init__(self, request):1406        self.request = request1407        super(Exception, self).__init__('A quiz must specify one correct answer' + self._fmt_request(self.request))1408    def __reduce__(self):1409        return type(self), (self.request,)1410class QuizCorrectAnswersTooMuchError(BadRequestError):1411    def __init__(self, request):1412        self.request = request1413        super(Exception, self).__init__('There can only be one correct answer' + self._fmt_request(self.request))1414    def __reduce__(self):1415        return type(self), (self.request,)1416class QuizCorrectAnswerInvalidError(BadRequestError):1417    def __init__(self, request):1418        self.request = request1419        super(Exception, self).__init__('The correct answer is not an existing answer' + self._fmt_request(self.request))1420    def __reduce__(self):1421        return type(self), (self.request,)1422class QuizMultipleInvalidError(BadRequestError):1423    def __init__(self, request):1424        self.request = request1425        super(Exception, self).__init__('A poll cannot be both multiple choice and quiz' + self._fmt_request(self.request))1426    def __reduce__(self):1427        return type(self), (self.request,)1428class RandomIdDuplicateError(ServerError):1429    def __init__(self, request):1430        self.request = request1431        super(Exception, self).__init__('You provided a random ID that was already used' + self._fmt_request(self.request))1432    def __reduce__(self):1433        return type(self), (self.request,)1434class RandomIdInvalidError(BadRequestError):1435    def __init__(self, request):1436        self.request = request1437        super(Exception, self).__init__('A provided random ID is invalid' + self._fmt_request(self.request))1438    def __reduce__(self):1439        return type(self), (self.request,)1440class RandomLengthInvalidError(BadRequestError):1441    def __init__(self, request):1442        self.request = request1443        super(Exception, self).__init__('Random length invalid' + self._fmt_request(self.request))1444    def __reduce__(self):1445        return type(self), (self.request,)1446class RangesInvalidError(BadRequestError):1447    def __init__(self, request):1448        self.request = request1449        super(Exception, self).__init__('Invalid range provided' + self._fmt_request(self.request))1450    def __reduce__(self):1451        return type(self), (self.request,)1452class ReactionEmptyError(BadRequestError):1453    def __init__(self, request):1454        self.request = request1455        super(Exception, self).__init__('No reaction provided' + self._fmt_request(self.request))1456    def __reduce__(self):1457        return type(self), (self.request,)1458class ReactionInvalidError(BadRequestError):1459    def __init__(self, request):1460        self.request = request1461        super(Exception, self).__init__('Invalid reaction provided (only emoji are allowed)' + self._fmt_request(self.request))1462    def __reduce__(self):1463        return type(self), (self.request,)1464class RegIdGenerateFailedError(ServerError):1465    def __init__(self, request):1466        self.request = request1467        super(Exception, self).__init__('Failure while generating registration ID' + self._fmt_request(self.request))1468    def __reduce__(self):1469        return type(self), (self.request,)1470class ReplyMarkupInvalidError(BadRequestError):1471    def __init__(self, request):1472        self.request = request1473        super(Exception, self).__init__('The provided reply markup is invalid' + self._fmt_request(self.request))1474    def __reduce__(self):1475        return type(self), (self.request,)1476class ReplyMarkupTooLongError(BadRequestError):1477    def __init__(self, request):1478        self.request = request1479        super(Exception, self).__init__('The data embedded in the reply markup buttons was too much' + self._fmt_request(self.request))1480    def __reduce__(self):1481        return type(self), (self.request,)1482class ResultIdDuplicateError(BadRequestError):1483    def __init__(self, request):1484        self.request = request1485        super(Exception, self).__init__('Duplicated IDs on the sent results. Make sure to use unique IDs.' + self._fmt_request(self.request))1486    def __reduce__(self):1487        return type(self), (self.request,)1488class ResultTypeInvalidError(BadRequestError):1489    def __init__(self, request):1490        self.request = request1491        super(Exception, self).__init__('Result type invalid' + self._fmt_request(self.request))1492    def __reduce__(self):1493        return type(self), (self.request,)1494class ResultsTooMuchError(BadRequestError):1495    def __init__(self, request):1496        self.request = request1497        super(Exception, self).__init__('You sent too many results. See https://core.telegram.org/bots/api#answerinlinequery for the current limit.' + self._fmt_request(self.request))1498    def __reduce__(self):1499        return type(self), (self.request,)1500class RightForbiddenError(ForbiddenError):1501    def __init__(self, request):1502        self.request = request1503        super(Exception, self).__init__('Either your admin rights do not allow you to do this or you passed the wrong rights combination (some rights only apply to channels and vice versa)' + self._fmt_request(self.request))1504    def __reduce__(self):1505        return type(self), (self.request,)1506class RpcCallFailError(BadRequestError):1507    def __init__(self, request):1508        self.request = request1509        super(Exception, self).__init__('Telegram is having internal issues, please try again later.' + self._fmt_request(self.request))1510    def __reduce__(self):1511        return type(self), (self.request,)1512class RpcMcgetFailError(BadRequestError):1513    def __init__(self, request):1514        self.request = request1515        super(Exception, self).__init__('Telegram is having internal issues, please try again later.' + self._fmt_request(self.request))1516    def __reduce__(self):1517        return type(self), (self.request,)1518class RsaDecryptFailedError(BadRequestError):1519    def __init__(self, request):1520        self.request = request1521        super(Exception, self).__init__('Internal RSA decryption failed' + self._fmt_request(self.request))1522    def __reduce__(self):1523        return type(self), (self.request,)1524class ScheduleBotNotAllowedError(BadRequestError):1525    def __init__(self, request):1526        self.request = request1527        super(Exception, self).__init__('Bots are not allowed to schedule messages' + self._fmt_request(self.request))1528    def __reduce__(self):1529        return type(self), (self.request,)1530class ScheduleDateTooLateError(BadRequestError):1531    def __init__(self, request):1532        self.request = request1533        super(Exception, self).__init__('The date you tried to schedule is too far in the future (last known limit of 1 year and a few hours)' + self._fmt_request(self.request))1534    def __reduce__(self):1535        return type(self), (self.request,)1536class ScheduleStatusPrivateError(BadRequestError):1537    def __init__(self, request):1538        self.request = request1539        super(Exception, self).__init__('You cannot schedule a message until the person comes online if their privacy does not show this information' + self._fmt_request(self.request))1540    def __reduce__(self):1541        return type(self), (self.request,)1542class ScheduleTooMuchError(BadRequestError):1543    def __init__(self, request):1544        self.request = request1545        super(Exception, self).__init__('You cannot schedule more messages in this chat (last known limit of 100 per chat)' + self._fmt_request(self.request))1546    def __reduce__(self):1547        return type(self), (self.request,)1548class SearchQueryEmptyError(BadRequestError):1549    def __init__(self, request):1550        self.request = request1551        super(Exception, self).__init__('The search query is empty' + self._fmt_request(self.request))1552    def __reduce__(self):1553        return type(self), (self.request,)1554class SecondsInvalidError(BadRequestError):1555    def __init__(self, request):1556        self.request = request1557        super(Exception, self).__init__('Slow mode only supports certain values (e.g. 0, 10s, 30s, 1m, 5m, 15m and 1h)' + self._fmt_request(self.request))1558    def __reduce__(self):1559        return type(self), (self.request,)1560class SendMessageMediaInvalidError(BadRequestError):1561    def __init__(self, request):1562        self.request = request1563        super(Exception, self).__init__('The message media was invalid or not specified' + self._fmt_request(self.request))1564    def __reduce__(self):1565        return type(self), (self.request,)1566class SendMessageTypeInvalidError(BadRequestError):1567    def __init__(self, request):1568        self.request = request1569        super(Exception, self).__init__('The message type is invalid' + self._fmt_request(self.request))1570    def __reduce__(self):1571        return type(self), (self.request,)1572class SessionExpiredError(UnauthorizedError):1573    def __init__(self, request):1574        self.request = request1575        super(Exception, self).__init__('The authorization has expired' + self._fmt_request(self.request))1576    def __reduce__(self):1577        return type(self), (self.request,)1578class SessionPasswordNeededError(UnauthorizedError):1579    def __init__(self, request):1580        self.request = request1581        super(Exception, self).__init__('Two-steps verification is enabled and a password is required' + self._fmt_request(self.request))1582    def __reduce__(self):1583        return type(self), (self.request,)1584class SessionRevokedError(UnauthorizedError):1585    def __init__(self, request):1586        self.request = request1587        super(Exception, self).__init__('The authorization has been invalidated, because of the user terminating all sessions' + self._fmt_request(self.request))1588    def __reduce__(self):1589        return type(self), (self.request,)1590class SessionTooFreshError(BadRequestError):1591    def __init__(self, request, capture=0):1592        self.request = request1593        self.seconds = int(capture)1594        super(Exception, self).__init__('The session logged in too recently and {seconds} seconds must pass before calling the method'.format(seconds=self.seconds) + self._fmt_request(self.request))1595    def __reduce__(self):1596        return type(self), (self.request, self.seconds)1597class Sha256HashInvalidError(BadRequestError):1598    def __init__(self, request):1599        self.request = request1600        super(Exception, self).__init__('The provided SHA256 hash is invalid' + self._fmt_request(self.request))1601    def __reduce__(self):1602        return type(self), (self.request,)1603class ShortnameOccupyFailedError(BadRequestError):1604    def __init__(self, request):1605        self.request = request1606        super(Exception, self).__init__('An error occurred when trying to register the short-name used for the sticker pack. Try a different name' + self._fmt_request(self.request))1607    def __reduce__(self):1608        return type(self), (self.request,)1609class SlowModeWaitError(FloodError):1610    def __init__(self, request, capture=0):1611        self.request = request1612        self.seconds = int(capture)1613        super(Exception, self).__init__('A wait of {seconds} seconds is required before sending another message in this chat'.format(seconds=self.seconds) + self._fmt_request(self.request))1614    def __reduce__(self):1615        return type(self), (self.request, self.seconds)1616class StartParamEmptyError(BadRequestError):1617    def __init__(self, request):1618        self.request = request1619        super(Exception, self).__init__('The start parameter is empty' + self._fmt_request(self.request))1620    def __reduce__(self):1621        return type(self), (self.request,)1622class StartParamInvalidError(BadRequestError):1623    def __init__(self, request):1624        self.request = request1625        super(Exception, self).__init__('Start parameter invalid' + self._fmt_request(self.request))1626    def __reduce__(self):1627        return type(self), (self.request,)1628class StatsMigrateError(InvalidDCError):1629    def __init__(self, request, capture=0):1630        self.request = request1631        self.dc = int(capture)1632        super(Exception, self).__init__('The channel statistics must be fetched from DC {dc}'.format(dc=self.dc) + self._fmt_request(self.request))1633    def __reduce__(self):1634        return type(self), (self.request, self.dc)1635class StickersetInvalidError(BadRequestError):1636    def __init__(self, request):1637        self.request = request1638        super(Exception, self).__init__('The provided sticker set is invalid' + self._fmt_request(self.request))1639    def __reduce__(self):1640        return type(self), (self.request,)1641class StickersEmptyError(BadRequestError):1642    def __init__(self, request):1643        self.request = request1644        super(Exception, self).__init__('No sticker provided' + self._fmt_request(self.request))1645    def __reduce__(self):1646        return type(self), (self.request,)1647class StickerEmojiInvalidError(BadRequestError):1648    def __init__(self, request):1649        self.request = request1650        super(Exception, self).__init__('Sticker emoji invalid' + self._fmt_request(self.request))1651    def __reduce__(self):1652        return type(self), (self.request,)1653class StickerFileInvalidError(BadRequestError):1654    def __init__(self, request):1655        self.request = request1656        super(Exception, self).__init__('Sticker file invalid' + self._fmt_request(self.request))1657    def __reduce__(self):1658        return type(self), (self.request,)1659class StickerIdInvalidError(BadRequestError):1660    def __init__(self, request):1661        self.request = request1662        super(Exception, self).__init__('The provided sticker ID is invalid' + self._fmt_request(self.request))1663    def __reduce__(self):1664        return type(self), (self.request,)1665class StickerInvalidError(BadRequestError):1666    def __init__(self, request):1667        self.request = request1668        super(Exception, self).__init__('The provided sticker is invalid' + self._fmt_request(self.request))1669    def __reduce__(self):1670        return type(self), (self.request,)1671class StickerPngDimensionsError(BadRequestError):1672    def __init__(self, request):1673        self.request = request1674        super(Exception, self).__init__('Sticker png dimensions invalid' + self._fmt_request(self.request))1675    def __reduce__(self):1676        return type(self), (self.request,)1677class StickerPngNopngError(BadRequestError):1678    def __init__(self, request):1679        self.request = request1680        super(Exception, self).__init__('Stickers must be a png file but the used image was not a png' + self._fmt_request(self.request))1681    def __reduce__(self):1682        return type(self), (self.request,)1683class StorageCheckFailedError(ServerError):1684    def __init__(self, request):1685        self.request = request1686        super(Exception, self).__init__('Server storage check failed' + self._fmt_request(self.request))1687    def __reduce__(self):1688        return type(self), (self.request,)1689class StoreInvalidScalarTypeError(ServerError):1690    def __init__(self, request):1691        self.request = request1692        super(Exception, self).__init__('' + self._fmt_request(self.request))1693    def __reduce__(self):1694        return type(self), (self.request,)1695class TakeoutInitDelayError(FloodError):1696    def __init__(self, request, capture=0):1697        self.request = request1698        self.seconds = int(capture)1699        super(Exception, self).__init__('A wait of {seconds} seconds is required before being able to initiate the takeout'.format(seconds=self.seconds) + self._fmt_request(self.request))1700    def __reduce__(self):1701        return type(self), (self.request, self.seconds)1702class TakeoutInvalidError(BadRequestError):1703    def __init__(self, request):1704        self.request = request1705        super(Exception, self).__init__('The takeout session has been invalidated by another data export session' + self._fmt_request(self.request))1706    def __reduce__(self):1707        return type(self), (self.request,)1708class TakeoutRequiredError(BadRequestError):1709    def __init__(self, request):1710        self.request = request1711        super(Exception, self).__init__('You must initialize a takeout request first' + self._fmt_request(self.request))1712    def __reduce__(self):1713        return type(self), (self.request,)1714class TempAuthKeyEmptyError(BadRequestError):1715    def __init__(self, request):1716        self.request = request1717        super(Exception, self).__init__('No temporary auth key provided' + self._fmt_request(self.request))1718    def __reduce__(self):1719        return type(self), (self.request,)1720class TimeoutError(TimedOutError):1721    def __init__(self, request):1722        self.request = request1723        super(Exception, self).__init__('A timeout occurred while fetching data from the worker' + self._fmt_request(self.request))1724    def __reduce__(self):1725        return type(self), (self.request,)1726class TmpPasswordDisabledError(BadRequestError):1727    def __init__(self, request):1728        self.request = request1729        super(Exception, self).__init__('The temporary password is disabled' + self._fmt_request(self.request))1730    def __reduce__(self):1731        return type(self), (self.request,)1732class TokenInvalidError(BadRequestError):1733    def __init__(self, request):1734        self.request = request1735        super(Exception, self).__init__('The provided token is invalid' + self._fmt_request(self.request))1736    def __reduce__(self):1737        return type(self), (self.request,)1738class TtlDaysInvalidError(BadRequestError):1739    def __init__(self, request):1740        self.request = request1741        super(Exception, self).__init__('The provided TTL is invalid' + self._fmt_request(self.request))1742    def __reduce__(self):1743        return type(self), (self.request,)1744class TypesEmptyError(BadRequestError):1745    def __init__(self, request):1746        self.request = request1747        super(Exception, self).__init__('The types field is empty' + self._fmt_request(self.request))1748    def __reduce__(self):1749        return type(self), (self.request,)1750class TypeConstructorInvalidError(BadRequestError):1751    def __init__(self, request):1752        self.request = request1753        super(Exception, self).__init__('The type constructor is invalid' + self._fmt_request(self.request))1754    def __reduce__(self):1755        return type(self), (self.request,)1756class UnknownMethodError(ServerError):1757    def __init__(self, request):1758        self.request = request1759        super(Exception, self).__init__('The method you tried to call cannot be called on non-CDN DCs' + self._fmt_request(self.request))1760    def __reduce__(self):1761        return type(self), (self.request,)1762class UntilDateInvalidError(BadRequestError):1763    def __init__(self, request):1764        self.request = request1765        super(Exception, self).__init__('That date cannot be specified in this request (try using None)' + self._fmt_request(self.request))1766    def __reduce__(self):1767        return type(self), (self.request,)1768class UrlInvalidError(BadRequestError):1769    def __init__(self, request):1770        self.request = request1771        super(Exception, self).__init__("The URL used was invalid (e.g. when answering a callback with an URL that's not t.me/yourbot or your game's URL)" + self._fmt_request(self.request))1772    def __reduce__(self):1773        return type(self), (self.request,)1774class UsernameInvalidError(BadRequestError):1775    def __init__(self, request):1776        self.request = request1777        super(Exception, self).__init__('Nobody is using this username, or the username is unacceptable. If the latter, it must match r"[a-zA-Z][\\w\\d]{3,30}[a-zA-Z\\d]"' + self._fmt_request(self.request))1778    def __reduce__(self):1779        return type(self), (self.request,)1780class UsernameNotModifiedError(BadRequestError):1781    def __init__(self, request):1782        self.request = request1783        super(Exception, self).__init__('The username is not different from the current username' + self._fmt_request(self.request))1784    def __reduce__(self):1785        return type(self), (self.request,)1786class UsernameNotOccupiedError(BadRequestError):1787    def __init__(self, request):1788        self.request = request1789        super(Exception, self).__init__('The username is not in use by anyone else yet' + self._fmt_request(self.request))1790    def __reduce__(self):1791        return type(self), (self.request,)1792class UsernameOccupiedError(BadRequestError):1793    def __init__(self, request):1794        self.request = request1795        super(Exception, self).__init__('The username is already taken' + self._fmt_request(self.request))1796    def __reduce__(self):1797        return type(self), (self.request,)1798class UsersTooFewError(BadRequestError):1799    def __init__(self, request):1800        self.request = request1801        super(Exception, self).__init__('Not enough users (to create a chat, for example)' + self._fmt_request(self.request))1802    def __reduce__(self):1803        return type(self), (self.request,)1804class UsersTooMuchError(BadRequestError):1805    def __init__(self, request):1806        self.request = request1807        super(Exception, self).__init__('The maximum number of users has been exceeded (to create a chat, for example)' + self._fmt_request(self.request))1808    def __reduce__(self):1809        return type(self), (self.request,)1810class UserAdminInvalidError(BadRequestError):1811    def __init__(self, request):1812        self.request = request1813        super(Exception, self).__init__("Either you're not an admin or you tried to ban an admin that you didn't promote" + self._fmt_request(self.request))1814    def __reduce__(self):1815        return type(self), (self.request,)1816class UserAlreadyParticipantError(BadRequestError):1817    def __init__(self, request):1818        self.request = request1819        super(Exception, self).__init__('The authenticated user is already a participant of the chat' + self._fmt_request(self.request))1820    def __reduce__(self):1821        return type(self), (self.request,)1822class UserBannedInChannelError(BadRequestError):1823    def __init__(self, request):1824        self.request = request1825        super(Exception, self).__init__("You're banned from sending messages in supergroups/channels" + self._fmt_request(self.request))1826    def __reduce__(self):1827        return type(self), (self.request,)1828class UserBlockedError(BadRequestError):1829    def __init__(self, request):1830        self.request = request1831        super(Exception, self).__init__('User blocked' + self._fmt_request(self.request))1832    def __reduce__(self):1833        return type(self), (self.request,)1834class UserBotError(BadRequestError):1835    def __init__(self, request):1836        self.request = request1837        super(Exception, self).__init__('Bots can only be admins in channels.' + self._fmt_request(self.request))1838    def __reduce__(self):1839        return type(self), (self.request,)1840class UserBotInvalidError(BadRequestError):1841    def __init__(self, request):1842        self.request = request1843        super(Exception, self).__init__('This method can only be called by a bot' + self._fmt_request(self.request))1844    def __reduce__(self):1845        return type(self), (self.request,)1846class UserBotRequiredError(BadRequestError):1847    def __init__(self, request):1848        self.request = request1849        super(Exception, self).__init__('This method can only be called by a bot' + self._fmt_request(self.request))1850    def __reduce__(self):1851        return type(self), (self.request,)1852class UserChannelsTooMuchError(ForbiddenError):1853    def __init__(self, request):1854        self.request = request1855        super(Exception, self).__init__('One of the users you tried to add is already in too many channels/supergroups' + self._fmt_request(self.request))1856    def __reduce__(self):1857        return type(self), (self.request,)1858class UserCreatorError(BadRequestError):1859    def __init__(self, request):1860        self.request = request1861        super(Exception, self).__init__("You can't leave this channel, because you're its creator" + self._fmt_request(self.request))1862    def __reduce__(self):1863        return type(self), (self.request,)1864class UserDeactivatedError(UnauthorizedError):1865    def __init__(self, request):1866        self.request = request1867        super(Exception, self).__init__('The user has been deleted/deactivated' + self._fmt_request(self.request))1868    def __reduce__(self):1869        return type(self), (self.request,)1870class UserDeactivatedBanError(UnauthorizedError):1871    def __init__(self, request):1872        self.request = request1873        super(Exception, self).__init__('The user has been deleted/deactivated' + self._fmt_request(self.request))1874    def __reduce__(self):1875        return type(self), (self.request,)1876class UserIdInvalidError(BadRequestError):1877    def __init__(self, request):1878        self.request = request1879        super(Exception, self).__init__('Invalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited' + self._fmt_request(self.request))1880    def __reduce__(self):1881        return type(self), (self.request,)1882class UserInvalidError(BadRequestError):1883    def __init__(self, request):1884        self.request = request1885        super(Exception, self).__init__('The given user was invalid' + self._fmt_request(self.request))1886    def __reduce__(self):1887        return type(self), (self.request,)1888class UserIsBlockedError(BadRequestError):1889    def __init__(self, request):1890        self.request = request1891        super(Exception, self).__init__('User is blocked' + self._fmt_request(self.request))1892    def __reduce__(self):1893        return type(self), (self.request,)1894class UserIsBotError(BadRequestError):1895    def __init__(self, request):1896        self.request = request1897        super(Exception, self).__init__("Bots can't send messages to other bots" + self._fmt_request(self.request))1898    def __reduce__(self):1899        return type(self), (self.request,)1900class UserKickedError(BadRequestError):1901    def __init__(self, request):1902        self.request = request1903        super(Exception, self).__init__('This user was kicked from this supergroup/channel' + self._fmt_request(self.request))1904    def __reduce__(self):1905        return type(self), (self.request,)1906class UserMigrateError(InvalidDCError):1907    def __init__(self, request, capture=0):1908        self.request = request1909        self.new_dc = int(capture)1910        super(Exception, self).__init__('The user whose identity is being used to execute queries is associated with DC {new_dc}'.format(new_dc=self.new_dc) + self._fmt_request(self.request))1911    def __reduce__(self):1912        return type(self), (self.request, self.new_dc)1913class UserNotMutualContactError(BadRequestError):1914    def __init__(self, request):1915        self.request = request1916        super(Exception, self).__init__('The provided user is not a mutual contact' + self._fmt_request(self.request))1917    def __reduce__(self):1918        return type(self), (self.request,)1919class UserNotParticipantError(BadRequestError):1920    def __init__(self, request):1921        self.request = request1922        super(Exception, self).__init__('The target user is not a member of the specified megagroup or channel' + self._fmt_request(self.request))1923    def __reduce__(self):1924        return type(self), (self.request,)1925class UserPrivacyRestrictedError(ForbiddenError):1926    def __init__(self, request):1927        self.request = request1928        super(Exception, self).__init__("The user's privacy settings do not allow you to do this" + self._fmt_request(self.request))1929    def __reduce__(self):1930        return type(self), (self.request,)1931class UserRestrictedError(ForbiddenError):1932    def __init__(self, request):1933        self.request = request1934        super(Exception, self).__init__("You're spamreported, you can't create channels or chats." + self._fmt_request(self.request))1935    def __reduce__(self):1936        return type(self), (self.request,)1937class VideoContentTypeInvalidError(BadRequestError):1938    def __init__(self, request):1939        self.request = request1940        super(Exception, self).__init__('The video content type is not supported with the given parameters (i.e. supports_streaming)' + self._fmt_request(self.request))1941    def __reduce__(self):1942        return type(self), (self.request,)1943class VideoFileInvalidError(BadRequestError):1944    def __init__(self, request):1945        self.request = request1946        super(Exception, self).__init__('The given video cannot be used' + self._fmt_request(self.request))1947    def __reduce__(self):1948        return type(self), (self.request,)1949class WallpaperFileInvalidError(BadRequestError):1950    def __init__(self, request):1951        self.request = request1952        super(Exception, self).__init__('The given file cannot be used as a wallpaper' + self._fmt_request(self.request))1953    def __reduce__(self):1954        return type(self), (self.request,)1955class WallpaperInvalidError(BadRequestError):1956    def __init__(self, request):1957        self.request = request1958        super(Exception, self).__init__('The input wallpaper was not valid' + self._fmt_request(self.request))1959    def __reduce__(self):1960        return type(self), (self.request,)1961class WcConvertUrlInvalidError(BadRequestError):1962    def __init__(self, request):1963        self.request = request1964        super(Exception, self).__init__('WC convert URL invalid' + self._fmt_request(self.request))1965    def __reduce__(self):1966        return type(self), (self.request,)1967class WebdocumentUrlInvalidError(BadRequestError):1968    def __init__(self, request):1969        self.request = request1970        super(Exception, self).__init__('The given URL cannot be used' + self._fmt_request(self.request))1971    def __reduce__(self):1972        return type(self), (self.request,)1973class WebpageCurlFailedError(BadRequestError):1974    def __init__(self, request):1975        self.request = request1976        super(Exception, self).__init__('Failure while fetching the webpage with cURL' + self._fmt_request(self.request))1977    def __reduce__(self):1978        return type(self), (self.request,)1979class WebpageMediaEmptyError(BadRequestError):1980    def __init__(self, request):1981        self.request = request1982        super(Exception, self).__init__('Webpage media empty' + self._fmt_request(self.request))1983    def __reduce__(self):1984        return type(self), (self.request,)1985class WorkerBusyTooLongRetryError(ServerError):1986    def __init__(self, request):1987        self.request = request1988        super(Exception, self).__init__('Telegram workers are too busy to respond immediately' + self._fmt_request(self.request))1989    def __reduce__(self):1990        return type(self), (self.request,)1991class YouBlockedUserError(BadRequestError):1992    def __init__(self, request):1993        self.request = request1994        super(Exception, self).__init__('You blocked this user' + self._fmt_request(self.request))1995    def __reduce__(self):1996        return type(self), (self.request,)1997rpc_errors_dict = {1998    'ABOUT_TOO_LONG': AboutTooLongError,1999    'ACCESS_TOKEN_EXPIRED': AccessTokenExpiredError,2000    'ACCESS_TOKEN_INVALID': AccessTokenInvalidError,2001    'ACTIVE_USER_REQUIRED': ActiveUserRequiredError,2002    'ADMINS_TOO_MUCH': AdminsTooMuchError,2003    'ADMIN_RANK_EMOJI_NOT_ALLOWED': AdminRankEmojiNotAllowedError,2004    'ADMIN_RANK_INVALID': AdminRankInvalidError,2005    'API_ID_INVALID': ApiIdInvalidError,2006    'API_ID_PUBLISHED_FLOOD': ApiIdPublishedFloodError,2007    'ARTICLE_TITLE_EMPTY': ArticleTitleEmptyError,2008    'AUTH_BYTES_INVALID': AuthBytesInvalidError,2009    'AUTH_KEY_DUPLICATED': AuthKeyDuplicatedError,...rooreduce.py
Source:rooreduce.py  
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3# =============================================================================4## @file ostap/fitting/rooreduce.py5#  Reduction/serialization/deserialization for some Ostap/ROOT classes  6#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru7#  @date   2011-06-078# =============================================================================9""" Reduction/serialization/deserialization for some Ostap/ROOT classes10- see RooAbsReal11- see RooRealVar12"""13# =============================================================================14__version__ = "$Revision$"15__author__  = "Vanya BELYAEV Ivan.Belyaev@itep.ru"16__date__    = "2011-06-07"17__all__     = (18    ) 19# =============================================================================20from   builtins                    import range21from   ostap.core.meta_info        import root_info 22from   ostap.math.base             import doubles23from   ostap.core.core             import Ostap24from   ostap.math.reduce           import root_factory25import ostap.fitting.variables26import ostap.fitting.roocollections27import ostap.histos.graph_reduce   as     GR 28import ROOT, random, array, ctypes, math, itertools    29# =============================================================================30# logging 31# =============================================================================32from ostap.logger.logger import getLogger 33if '__main__' ==  __name__ : logger = getLogger( 'ostap.fitting.rooreduce' )34else                       : logger = getLogger( __name__ )35# =============================================================================36logger.debug( 'Some useful decorations for RooFit variables')37# =============================================================================38_new_methods_ = []39# =============================================================================40## Factory for deserialization of generic objects41#  @attention it stores the constructor kaprameters as local attributes42def root_store_factory ( klass , *params ) :43    """Factory for deserialization of generic object44    - attention: it stores the constructor kaprameters as local attributes45    """46    ## create the objects 47    obj = root_factory ( klass , *params )48    ## keep argumets with the newly created obnject  49    obj.__store = params    ## Attention - keep argumetns with newly crfeated object!50    return obj 51# =============================================================================52## Some native ROOT/RooFit objects 53# =============================================================================54    55# =============================================================================56## Dedicated unpickling factory for RooRealVar57def _rrv_factory ( args , errors , binnings , fixed , *attrs ) :58    """ Dedicated unpickling factory for `ROOT.RooRealVar`59    """60    ## create it61    rrv = ROOT.RooRealVar ( *args )62    ## set errors if needed 63    if   errors and  2 == len ( errors ) : rrv.setAsymError ( *errors ) 64    elif errors and  1 == len ( errors ) : rrv.setError     ( *errors )65    for b in binnings :66        if b : rrv.setBinning ( b , b.GetName ()) 67    rrv.setConstant ( fixed )68    69    if attrs :70        battrs = attrs[0] 71        for n , a in battrs : rrv.setAttribute          ( n , a )72        if 1 < len ( attrs ) :73            sattrs = attrs[1] 74            for n , a in sattrs : rrv.setStringAttribute    ( n , a )75            if 2 < len ( attrs ) :76                tattrs = attrs[2]             77                for n , a in tattrs : rrv.setTransientAttribute ( n , a ) 78    79    return rrv80# =============================================================================81## Reducing of <code>RooRealVar</code> for pickling/unpickling 82#  @see RooRooRealVar 83def _rrv_reduce ( rrv ) :84    """ Reducing of `ROOT.RooRealVar` for pickling 85    - see ROOT.RooRooRealVar 86    """87    name    = rrv.name 88    title   = rrv.title89    value   = rrv.getVal () 90    has_min = rrv.hasMin ()91    has_max = rrv.hasMax ()92    ## constructor arguments 93    if has_min and has_max :94        args = name , title , value ,  rrv.getMin () , rrv.getMax ()              , rrv.getUnit ()95    elif has_min : 96        args = name , title , value ,  rrv.getMin () , ROOT.RooNumber.infinity () , rrv.getUnit () 97    elif has_max : 98        args = name , title , value , -ROOT.RooNumber.infinity () , rrv.getMax () , rrv.getUnit () 99    else :100        args = name , title , value ,  rrv.getUnit () 101    ## errors 102    if   rrv.hasAsymError () :103        errors = rrv.getAsymErrorLo () , rrv.getAsymErrorHi ()104    elif rrv.hasError   () :105        errors = rrv.getError() ,106    else :107        errors = () 108    ## binings 109        110    binnings = tuple (   rrv.getBinning ( n , False )       for n in rrv.getBinningNames     () )111    ## attributes:112    113    battrs   = tuple ( ( n , rrv.getAttribute          ( n ) ) for   n       in rrv.attributes          () ) 114    sattrs   = tuple ( ( n , a                               ) for ( n , a ) in rrv.stringAttributes    () ) 115    tattrs   = tuple ( ( n , rrv.getTransientAttribute ( n ) ) for   n       in rrv.transientAttributes () ) 116    ## fixed ? 117    fixed = True if rrv.isConstant() else False 118    if tattrs : 119        content = args , errors , binnings , fixed , battrs , sattrs , tattrs120    elif sattrs :121        content = args , errors , binnings , fixed , battrs , sattrs122    elif battrs : 123        content = args , errors , binnings , fixed , battrs 124    else :        125        content = args , errors , binnings , fixed 126    127    return _rrv_factory , content 128ROOT.RooRealVar.__reduce__ = _rrv_reduce129# =============================================================================130## Reduce <code>RooConstVar</code>131#  @see RooConstVar 132def _rconst_reduce ( var ) :133    """ Reduce `ROOT.RooConstVar`134    - see ROOT.RooConstVar135    """136    return root_factory , ( type ( var )  ,137                            var.name      ,138                            var.title     ,139                            float ( var ) )  140ROOT.RooConstVar.__reduce__ = _rconst_reduce 141# ==============================================================================142## factory for RooCategory objects143#  @see RooCategory144def _rcat_factory_  ( klass , name , title , index  , items ) :145    """factory for `ROOT.RooCategory` objects146    - see `ROOT.RooCategory`147    """148    cat = klass ( name , title )149    for label , index  in items : cat.defineType ( label , index )150    cat.setIndex ( index ) 151    return cat152# =============================================================================153## reduce RooCategory instance 154#  @see RooCategory155def _rcat_reduce_ ( cat ) :156    """reduce RooCategory instance 157    - see `ROOT.RooCategory`158    """159    items = tuple ( (l,i) for (l,i) in cat.items() )160    return _rcat_factory_ , ( type ( cat ) , cat.GetName() , cat.GetTitle() , cat.getIndex() , items ) 161ROOT.RooCategory   .__reduce__    = _rcat_reduce_ 162# =============================================================================163## factory for unpickling of <code>RooFormulaVar</code> and164#  <code>Ostap::FormulaVar</code>165#  @see RooFormualVar 166#  @see Ostap::FormualVar 167def _rfv_factory ( klass , args , vars ) :168    """Factory for unpickling of `RooFormulaVar` and `Ostap.FormulaVar`169    - see ROOT.RooFormulaVar 170    - see Ostap.FormualVar 171    """172    lst = ROOT.RooArgList ()173    for v in vars : lst.add ( v ) 174    margs = list  ( args  )175    margs.append  ( lst   )176    margs = tuple ( margs ) 177    178    rfv = klass   ( *margs )179    180    rfv.__args = args, vars, lst181    return rfv182    183# =============================================================================184## Reduce <code>RooFormulaVar</code> and <code>Ostap::FormulaVar</code> for pickling185#  @see RooFormulaVar 186#  @see Ostap::FormulaVar 187def _rfv_reduce ( rfv ) : 188    """Reduce `RooFormulaVar` and `Ostap::FormulaVar` for pickling189    - see RooFormulaVar 190    - see Ostap.FormulaVar 191    """192    name       = rfv.GetName     ()193    title      = rfv.GetTitle    ()194    195    rform      = rfv.formula     ()    196    expression = rform.GetTitle  () 197    vars       = tuple ( d for d in rform.actualDependents() ) 198    args       = name , title , expression199    200    return _rfv_factory , ( type ( rfv ) , args , vars ) 201if (6,22) <= root_info : ROOT.RooFormulaVar.__reduce__  = _rfv_reduce202else                   : Ostap.FormulaVar.__reduce__    = _rfv_reduce203# =============================================================================204## unpickle RooUniformBinning object205#  @see RooUniformBinnig  206def _rub_factory ( *args ) :207    """unpickle RooUniformBinning object208    -see ROOT.RooUniformBinnig209    """210    return ROOT.RooUniformBinning ( *args )211# =============================================================================212## reduce uniform binning scheme213#  @see RoUniformBinnig 214def _rub_reduce_ ( rub ) :215    """Reduce RooUniformBininkg Object216    - see ROOT.RooUniformBinning217    """218    nbins = rub.numBoundaries()219    if nbins : nbins -= 1220    content = rub.lowBound () , rub.highBound(), nbins , rub.GetName()221    222    return _rub_factory, content223# =============================================================================224## unpickle RooBinning object225#  @see RooBinnig  226def _rb_factory ( data , name  ) :227    """unpickle RooBinning object228    -see ROOT.RooUniformBinnig229    """230    return ROOT.RooBinning ( len ( data ) - 1 , data [ 0 ] , name )231# =============================================================================232## reduce RooBinning object233#  @see RooBinning 234def _rb_reduce_ ( rb  )  :235    """Reduce RooBinning object236    - see ROOT.RooBinning 237    """238    if rb.isUniform() : return _rub_reduce_ ( rb )239    nb    = rb.numBoundaries() 240    ab    = rb.array ()241    data  = array.array ( 'd' , [ 1.0 * ab[i] for i in range ( nb ) ] )242    content = data, rb.GetName()  243    return _rb_factory, content244# ==========================================================================245## unpickle RooRangeBinning object246#  @see RooRangeBinnig 247def _rrb_factory ( low , high , name ) :248    """unpickle RooRangeBinning object"""249    return ROOT.RooRangeBinning( low , high , name )250# ============================================================================251## reduce RooRangeBinnig object252#  @see RooRangeBinnig 253def _rrb_reduce_ ( rrb ) :254    """Reduce RooRangeBinnig object"""255    return _rrb_factory ,  ( rrb.lowBound() , rrb.highBound() , rrb.GetName() ) 256ROOT.RooBinning       .__reduce__ = _rb_reduce_257ROOT.RooUniformBinning.__reduce__ = _rub_reduce_258ROOT.RooRangeBinning  .__reduce__ = _rrb_reduce_259    260if not hasattr ( ROOT.RooGaussian , 'getX' ) :261    def _rgau_x_ ( pdf ) :262        """Get x-observable"""263        return Ostap.MoreRooFit.getX ( pdf )264    ROOT.RooGaussian.getX = _rgau_x_265    _new_methods_ += [ ROOT.RooGaussian.getX ]266if not hasattr ( ROOT.RooGaussian , 'getMean' ) :267    def _rgau_mean_ ( pdf ) :268        """Get x-observable"""269        return Ostap.MoreRooFit.getMean ( pdf )270    ROOT.RooGaussian.getMean = _rgau_mean_271    _new_methods_ += [ ROOT.RooGaussian.getMean ]272if not hasattr ( ROOT.RooGaussian , 'getSigma' ) :273    def _rgau_sigma_ ( pdf ) :274        """Get sigma"""275        return Ostap.MoreRooFit.getSigma ( pdf )276    ROOT.RooGaussian.getSigma = _rgau_sigma_277    _new_methods_ += [ ROOT.RooGaussian.getSigma ]278# ==========================================================================--279## reduce  RooGaussian object 280def _rgau_reduce_ ( pdf ) :281    """Reduce `RooGaussian` object"""282    return root_store_factory , ( type ( pdf )    ,283                                  pdf.name        ,284                                  pdf.title       ,285                                  pdf.getX     () ,286                                  pdf.getMean  () , 287                                  pdf.getSigma () )288ROOT.RooGaussian.__reduce__ = _rgau_reduce_ 289if not hasattr ( ROOT.RooMultiVarGaussian , 'observables' ) :290    def _rmvgau_observables_ ( pdf ) :291        """Get observables"""292        return Ostap.MoreRooFit.observables( pdf )293    ROOT.RooMultiVarGaussian.observables = _rmvgau_observables_294    _new_methods_ += [ ROOT.RooMultiVarGaussian.observables ]295if not hasattr ( ROOT.RooMultiVarGaussian , 'mu_vec' ) :296    def _rmvgau_mu_vec_ ( pdf ) :297        """Get mu-vec"""298        return Ostap.MoreRooFit.mu_vec ( pdf )299    ROOT.RooMultiVarGaussian.mu_vec = _rmvgau_mu_vec_300    _new_methods_ += [ ROOT.RooMultiVarGaussian.mu_vec ]301# ================================================================================302## deserialize RooMultiVarGaussian object303#  @see RooMultiVarGaussian304def _rmvgau_factory_ ( klass , *args ) :305    """Deserialize `ROOT.RooMultiVarGaussian` 306    - see `ROOT.RooMultiVarGaussian`307    """308    if 5 != len ( args ) : raise pickle.UnpicklingError("RooMultiVarGaussian: ivalid record length!")309    muvec  = args [3]310    covm   = args [4]311    N = len ( muvec )312    if N * N != len ( covm ) : raise pickle.UnpicklingError("RooMultiVarGaussian: cannot reconstruct covmatrix")313    314    muvec = ROOT.TVectorD    ( N , muvec )315    covm  = ROOT.TMatrixDSym ( N , covm  )316    317    newargs = args [:3]  + ( muvec, covm ) 318    return root_store_factory ( klass , *newargs )  319    320# ==========================================================================--321## reduce  RooMultiVarGaussian object 322def _rmvgau_reduce_ ( pdf ) :323    """Reduce `RooMultiVarGaussian` object"""324    return _rmvgau_factory_ , ( type ( pdf )                                  ,325                                pdf.name                                      ,326                                pdf.title                                     ,327                                pdf.observables      ()                       ,328                                array.array ( 'd' , pdf.mu_vec ()           ) , 329                                array.array ( 'd' , pdf.covarianceMatrix () ) )330ROOT.RooMultiVarGaussian.__reduce__ = _rmvgau_reduce_ 331# ==========================================================================--332## Get the original fractions from the <code>RooAddPdf</code>333#  @code334#  addpdf = ...335#  fractions , recursive = addpdf.orig_fracs() 336#  @endcode 337#  @see RooAddPdf 338def _raddpdf_fractions ( radd ) :339    """ Get the original fractions from the <code>RooAddPdf</code>340    >>> addpdf = ...341    >>> fractions , recursive = addpdf.orig_fracs() 342    """343    rec   = ctypes.c_bool ()344    fracs = Ostap.MoreRooFit.fractions ( radd , rec )345    return fracs, rec.value346    347# ==========================================================================--348ROOT.RooAddPdf  .orig_fracs = _raddpdf_fractions349_new_methods_ += [ ROOT.RooAddPdf  .orig_fracs ] 350# ==========================================================================--351## reduce  RooAddPdf object 352def _raddpdf_reduce_ ( pdf ) :353    """Reduce `RooAddPdf` object"""354    content = type ( pdf ) , pdf.name , pdf.title , pdf.pdfList()355    pars    = pdf.coefList ()356    if 1 <= len ( pars ) :357        content   = content + pdf.orig_fracs () 358    return root_store_factory , content359ROOT.RooAddPdf.__reduce__ = _raddpdf_reduce_ 360# =============================================================================361## Is this <code>RooProdPdf</code> object conditional ?362#  @see RooProdPdf 363def _rprodpdf_cond_ ( pdf ) :364    """Is this `RooProdPdf` object conditional ?365    - see `ROOT.RooProdPdf` 366    """367    for p in pdf.pdfList() :368        vset = pdf.findPdfNSet ( p )369        if not set             : continue370        elif 1 <= len ( vset ) : return True 371    return False372ROOT.RooProdPdf.conditional = _rprodpdf_cond_ 373_new_methods_ += [ ROOT.RooProdPdf.conditional ]374# =============================================================================375## reduce RooProdPdf 376#  @see RooProdPdf377def _rprodpdf_reduce_ ( pdf ) :378    """Reduce `ROOT.RooProdPdf`379    - see `ROOT.RooProdPdf`380    """381    if pdf.conditional () :382        import pickle383        raise pickle.PicklingError("RooProdPdf is conditional (cannot be picked)")384    385    content = type ( pdf ) , pdf.name , pdf.title , pdf.pdfList()386    return root_store_factory , content387ROOT.RooProdPdf.__reduce__ = _rprodpdf_reduce_ 388# =============================================================================389## Factory for RooFFTConfPdf 390#  @see RooFFTConfPdf 391def _rfft_factory_ ( klass , args , params ) :392    """Factory for `ROOT.RooFFTConvPdf` 393    - see `ROOT.RooFFTConvPdf`394    """395    pdf = klass ( *args )396    pdf.__args = args 397    bs , bf , s1 , s2 = params398    pdf.setBufferStrategy ( bs )399    pdf.setBufferFraction ( bf )400    pdf.setShift ( s1 , s2 ) 401    return pdf402# =============================================================================403## reduce RooFFTConvPdf404#  @see RooFFTConvPdf 405def _rfft_reduce_ ( pdf ) :406    s1 = ctypes.c_double ( 0 )407    s2 = ctypes.c_double ( 0 )408    pars   = Ostap.MoreRooFit.fft_pars ( pdf , s1 , s2 )409    args   = ( pdf.name , pdf.title )  + \410             tuple ( p for p in pars ) + \411             ( pdf.getInterpolationOrder() , ) 412    413    params =  pdf.bufferStrategy() , pdf.bufferFraction() , s1.value , s2.value414    return _rfft_factory_ , ( type ( pdf ) , args , params )415    416ROOT.RooFFTConvPdf.__reduce__ = _rfft_reduce_ 417# =============================================================================418## Factory for RooSimultaneous419#  @see RooSimultaneous 420def _rsim_factory_ ( klass , args , catlst ) :421    """Factory for `ROOT.RooSimultaneous` 422    - see `ROOT.Simultaneous`423    """424    pdf = klass ( *args )425    for l , p in catlst : pdf.addPdf ( p , l )426    pdf.__catlst = catlst 427    return pdf428# ================================================================================429## Reduce RooSimultaneous object430#  @see RooSimultaneous 431def _rsim_reduce_ ( pdf ) :432    """Reduce RooSimultaneous object433    -see RooSimultaneous 434    """435    cat    = pdf.indexCat()436    labels = cat.labels()437    catlst = tuple ( ( l , pdf.getPdf(l) ) for l in labels )438    args   = pdf.name , pdf.title , cat 439    return _rsim_factory_ , ( type ( pdf ) , args , catlst ) 440ROOT.RooSimultaneous.__reduce__  = _rsim_reduce_ 441# =============================================================================442## access to underlying efficiency function from RooEfficiency443#  @see RooEfficiency 444#  @see Ostap::MorERooFit::get_eff 445def _reff_efficiency_  ( pdf )  :446    """Access to underlying efficiency function from RooEfficiency447    - see `ROOT.RooEfficiency`448    - see `Ostap.MoreRooFit.get_eff`449    """450    return Ostap.MoreRooFit.get_eff ( pdf )451# =============================================================================452## access to underlying accept/reject category from RooEfficiency453#  @see RooEfficiency 454#  @see Ostap::MorERooFit::get_cat 455def _reff_category_  ( pdf )  :456    """Access to underlying accept/reject category from RooEfficiency457    - see `ROOT.RooEfficiency`458    - see `Ostap.MoreRooFit.get_cat`459    """460    return Ostap.MoreRooFit.get_cat ( pdf )461# =============================================================================462## access to accept category from RooEfficiency463#  @see RooEfficiency 464#  @see Ostap::MorERooFit::get_acc465def _reff_accept_  ( pdf )  :466    """Access to accept category from RooEfficiency467    - see `ROOT.RooEfficiency`468    - see `Ostap.MoreRooFit.get_acc`469    """470    return Ostap.MoreRooFit.get_acc ( pdf )471ROOT.RooEfficiency. efficiency = _reff_efficiency_472ROOT.RooEfficiency. category   = _reff_category_473ROOT.RooEfficiency. accept     = _reff_accept_474_new_methods_ += [475    ROOT.RooEfficiency. efficiency , 476    ROOT.RooEfficiency. category   , 477    ROOT.RooEfficiency. accept     , 478    ]479# =============================================================================480## reduce RooEfficiency481#  @see RooEfficiency482def _reff_reduce_ ( pdf ) :483    """Reduce `ROOT.RooEfficiency`484    - see `ROOT.RooEfficiency`485    """486    return root_store_factory , ( type ( pdf )     ,487                                  pdf.name         ,488                                  pdf.title        ,489                                  pdf.efficiency() , 490                                  pdf.category  () , 491                                  pdf.accept    () )492ROOT.RooEfficiency.__reduce__  = _reff_reduce_ 493# ================================================================================494## get the list of coefficients from <code>RooPolyVar</code>495#  @see RooPolyVar496def _rpv_coefficients_ ( var ) :497    """Get the list of coefficients from `ROOT.RooPolyVar`498    -see `ROOT.RooPolyVar`499    """500    return Ostap.MoreRooFit.coefficients ( var ) 501ROOT.RooPolyVar   . coefficients = _rpv_coefficients_502ROOT.RooPolynomial. coefficients = _rpv_coefficients_503_new_methods_ += [504    ROOT.RooPolyVar   . coefficients  ,505    ROOT.RooPolynomial. coefficients  ,506    ]507# =============================================================================508## reduce RooPolyVar509#  @see RooPolyVar510def _rpv_reduce_ ( var ) :511    """Reduce `ROOT.RooPolyVar`512    - see `ROOT.RooPolyVar`513    """514    return root_store_factory , ( type ( pdf )        ,515                                  pdf.name            ,516                                  pdf.title           ,517                                  pdf.coefficients () )518ROOT.RooPolyVar   . __reduce__  = _rpv_reduce_519ROOT.RooPolynomial. __reduce__  = _rpv_reduce_520# ================================================================================521## deserialize RooFitResult522#  @see RooFitResult523#  @see Ostap::Utils::FitResults524def _rrfr_factory_ ( klass , *args ) :525    """Deserialize RooFitResult526    - see `ROOT.RooFitResult`527    - see `Ostap.Utils.FitResults`528    """529    ## create530    newargs = args [ : 10 ] 531    covargs = args [   10 ] ## covariance related arguments 532    history = args [   11 ] ## the last argument, history 533    import pickle534    if 3 == len ( covargs ) :535        536        gcc , corm , covm = covargs 537        D    = len ( gcc )538        539        if D * D != len ( corm ) : raise pickle.UnpicklingError("FitResult(1): cannot reconstruct cormatrix")540        if D * D != len ( covm ) : raise pickle.UnpicklingError("FitResult(1): cannot reconstruct covmatrix")541        gcc      = doubles ( gcc ) 542        corm     = ROOT.TMatrixDSym ( D , corm )543        covm     = ROOT.TMatrixDSym ( D , covm )544        545        newargs +=  gcc , corm , covm546        547    else :548        549        covm = covargs 550        551        l2 = len ( covm )552        D  = int ( math.sqrt ( l2 ) ) 553        if D * D != l2 :554            raise pickle.UnpicklingError("FitResult(2): cannot reconstruct covmatrix")555        covm = ROOT.TMatrixDSym ( D , covm )556        newargs += covm ,557            558    tmpres = klass ( *newargs )559    560    for label , code in history : tmpres.add_to_history ( label , code )561    562    result = ROOT.RooFitResult ( tmpres )563    result.__args = args564    565    return result 566   567# ================================================================================568## Reduce RooFitResult569#  @see RooFitResult570def _rrfr_reduce_ ( res ) :571    """ Reduce `RooFitResult`572    - see `ROOT.RooFitResult`573    """574    nr      = Ostap.Utils.FitResults ( res )575    content = type ( nr )      , res.name , res.title , \576              res.constPars () , res.floatParsInit()  , res.floatParsFinal() , \577              nr.status     () , nr.covQual()         , nr.minNll()          , \578               nr.edm       () , nr.numInvalidNLL ()579    gcc  = nr.global_cc()580    N    = len ( gcc )581    covm = res.covarianceMatrix  ()582    corm = res.correlationMatrix ()583    if gcc and 1 <= N and covm.IsValid() and corm.IsValid() and N == covm.GetNrows() and N == corm.GetNrows() : 584        covargs = ( array.array ( 'd' , gcc  ) ,585                    array.array ( 'd' , corm ) ,586                    array.array ( 'd' , covm ) )587    else :588        covargs = array.array ( 'd' , covm )  589        590    history = tuple ( ( nr.statusLabelHistory(i) ,nr.statusCodeHistory(i) ) \591                      for i in range ( nr.numStatusHistory () ) )592    593    content += covargs , history 594  595    return _rrfr_factory_ , content 596ROOT.RooFitResult.__reduce__  = _rrfr_reduce_ 597# =============================================================================598## reconstruct/deserialize <code>RooPlot</code> object599def _rplot_factory_ ( klass , xmin , xmax , ymin , ymax , items )  :600    """Reconstruct/deserialize `ROOT.RooPlot` object601    """602    plot = klass  ( xmin , xmax , ymin , ymax )603    ##604    for ( obj , options , invisible ) in items :605        if   isinstance ( obj  , ROOT.RooPlotable ) :            606            plot.addPlotable ( obj , options , invisible )607        elif isinstance ( obj  , ROOT.TH1 ) and 1 == obj.GetDimension() :608            plot.addTH1      ( obj , options , invisible )609        else :610            plot.addObject   ( obj , options , invisible )            611    ## 612    plot.__store = items  ## ATTENTION!! keep the items! 613    return plot 614                615# =============================================================================616## reduce RooPlot object617def _rplot_reduce_ ( plot ) :618    """Reduce `ROOT.RooPlot` object"""619    return _rplot_factory_ , ( type ( plot )   ,620                               plot.GetXaxis().GetXmin() ,621                               plot.GetXaxis().GetXmax() ,622                               plot.GetMinimum () ,623                               plot.GetMaximum () ,624                               tuple ( i for i in plot.items() ) )625ROOT.RooPlot.__reduce__  = _rplot_reduce_ 626# ===============================================================================627## reconstruct/deserialize/unpickle <code>TGraph</code> object628#  @see RooCurve629#  @see RooPlotable630#  @see TGraph631def _rcurv_factory_ ( klass , *args ) : 632    """Reconstruct/deserialize/unpickle `ROOT.RooCurve` object633    -see `ROOT.RooCurve`634    -see `ROOT.RooPlotable`635    -see `ROOT.TGraph`636    """637    graph     = GR.graph_factory ( klass , *args [:-1] )638    ## 639    rplotatts = args[-1]640    graph.setYAxisLabel  (  rplotatts [0 ] )641    graph.setYAxisLimits ( *rplotatts [1:] )642    ## 643    return graph 644# =============================================================================645## Reduce/serialize/pickle  simple <code>TGraph</code> object646#  @see ROOT.TGraph647def _rcurv_reduce_ ( graph ) :648    """Reduce/serialize/pickle simple `ROOT.RooCurve` object\649    - see `ROOT.RooCurve`650    - see `ROOT.RooEllipse`651    - see `ROOT.RooPlotable`652    - see `ROOT.TGraph`653    """654    _ , content = GR.graph_reduce ( graph )655    rplotatts   = graph.getYAxisLabel () , graph.getYAxisMin (), graph.getYAxisMax ()656    return _rcurv_factory_ , content + ( rplotatts , ) 657ROOT.RooCurve  .__reduce__ = _rcurv_reduce_658ROOT.RooEllipse.__reduce__ = _rcurv_reduce_659# ===============================================================================660## reconstruct/deserialize/unpickle <code>RooHist</code> object661#  @see RooHist662#  @see RooPlotable663#  @see TGraphAsymmErrors664def _rhist_factory_ ( klass , *args ) :665    """Reconstruct/deserialize/unpickle `ROOT.RooHist` object666    -see `ROOT.RooHist`667    -see `ROOT.RooPlotable`668    -see `ROOT.TGraphAsymmErrors`669    """670    graph     = GR.graph_asymerrors_factory ( klass , *args [:-1] )671    rplotatts = args[-1]672    graph.setYAxisLabel  (  rplotatts [0 ] )673    graph.setYAxisLimits ( *rplotatts [1:] )674    ## 675    return graph 676# =============================================================================677## Reduce/serialize/pickle  simple <code>RooHist</code> object678#  @see ROOT.RooHist679#  @see ROOT.TGraphAsymmErorrs680def _rhist_reduce_ ( graph ) :681    """Reduce/serialize/pickle simple `ROOT.RooHist` object682    - see `ROOT.RooHist`683    - see `ROOT.TGraphAsymmErrors`684    """685    _ , content = GR.graph_asymerrors_reduce ( graph )686    rplotatts   = graph.getYAxisLabel (), graph.getYAxisMin (), graph.getYAxisMax () 687    return _rhist_factory_ , content + ( rplotatts , ) 688ROOT.RooHist.__reduce__ = _rhist_reduce_689# =============================================================================690## Reduce <code>Ostap::MoreRooFit::TwoVars</code> objects691#  @see Ostap::MoreRooFit.TwoVars692def _r2v_reduce ( var ) :693    """Reduce `Ostap::MoreRooFit::TwoVars` objects694    - see Ostap.MoreRooFit.TwoVars695    """696    return root_store_factory , ( type ( var ) , var.name , var.title , var.x() , var.y() )697Ostap.MoreRooFit.TwoVars.__reduce__  = _r2v_reduce698# ===================================================================699## Reduce <code>Ostap::MoreRooFit::Addition</code> objects700#  @see Ostap::MoreRooFit.Addition701def _radd1_reduce ( var ) :702    """Reduce `Ostap.MoreRooFit.Addition` objects703    - see Ostap.MoreRooFit.Addition704    """705    content = type ( var ) , var.name , var.title , var.x () , var.y ()706    return root_store_factory , content 707# ===================================================================708## Reduce <code>Ostap::MoreRooFit::Addition3</code> objects709#  @see Ostap::MoreRooFit.Addition3710def _radd2_reduce ( var ) :711    """Reduce `Ostap.MoreRooFit.Addition` objects712    - see Ostap.MoreRooFit.Addition2713    """714    content = type ( var ) , var.name , var.title , var.x () , var.y () , var.c1 () , var.c2 () 715    return root_store_factory , content716# =============================================================================717## reduce <code>Ostap::MoreRooFit::Id<code> object718#  @see Ostap.MoreRooFit::Id719def _rid_reduce ( var ) :720    """Reduce `Ostap.MoreRooFit.Id` object721    - see Ostap.MoreRooFit.Id722    """723    return root_store_factory , ( type ( var ) ,724                                  var.name     ,725                                  var.title    ,726                                  var.x ()     )727# =============================================================================728## reduce <code>Ostap::MoreRooFit::AddDeps<code> object729#  @see Ostap.MoreRooFit::AddDeps730def _radddep_reduce ( var ) :731    """Reduce `Ostap.MoreRooFit.AddDeps` object732    - see Ostap.MoreRooFit.AddDeps733    """734    return root_store_factory , ( type ( var ) ,735                                  var.name     ,736                                  var.title    ,737                                  var.x ()     ,738                                  var.vlst()   )739Ostap.MoreRooFit.Addition    .__reduce__  = _radd1_reduce740Ostap.MoreRooFit.Addition2   .__reduce__  = _radd2_reduce741Ostap.MoreRooFit.Subtraction .__reduce__  = _r2v_reduce742Ostap.MoreRooFit.Product     .__reduce__  = _r2v_reduce743Ostap.MoreRooFit.ProductPdf  .__reduce__  = _r2v_reduce744Ostap.MoreRooFit.Id          .__reduce__  = _rid_reduce745Ostap.MoreRooFit.AddDeps     .__reduce__  = _radddep_reduce746# ===================================================================747## Reduce <code>Ostap::MoreRooFit::Combination</code> objects748#  @see Ostap::MoreRooFit.Combination749def _rcomb_reduce ( var ) :750    """Reduce `Ostap.MoreRooFit.Combination` objects751    - see Ostap.MoreRooFit.Combination752    """753    return root_store_factory , ( type ( var ) ,754                                  var.name     ,755                                  var.title    ,756                                  var.x()      ,757                                  var.y()      ,758                                  var.alpha () ,759                                  var.beta  () ,760                                  var.gamma () )761Ostap.MoreRooFit.Combination.__reduce__  = _rcomb_reduce762# ===================================================================763## Reduce <code>Ostap::MoreRooFit::Asymmetry</code> objects764#  @see Ostap::MoreRooFit.Asymmetry765def _rasym_reduce ( var ) :766    """Reduce  `Ostap::MoreRooFit::Asymmetry` objects767    - see Ostap.MoreRooFit.Asymmetry768    """769    return root_store_factory , ( type ( var ) ,770                                  var.name , var.title ,771                                  var.x()  , var.y()   ,772                                  var.scale () )773Ostap.MoreRooFit.Asymmetry.  __reduce__  = _rasym_reduce774# =============================================================================775## Reduce <code>Ostap::MoreRooFit::Constant</code>776def _rconst2_reduce ( var ) :777    """ Reduce `ROOT.RooConstVar`778    """779    return root_store_factory , ( type ( var )  ,780                                  var.name      ,781                                  var.title     ,782                                  float ( var ) ,783                                  var.vlst()    )784Ostap.MoreRooFit.Constant.  __reduce__  = _rconst2_reduce785# =============================================================================786## Reduce <code>Ostap::MoreRooFit::Bernstein</code> object 787#  @see Ostap::MoreRooDit::Bernstein788def _rbern_reduce ( var ) :789    """Reduce `Ostap.MoreRooFit.Bernstein` object 790    - see Ostap.MoreRooDit.Bernstein791    """792    return root_store_factory , ( type ( var )  ,793                                  var.name      ,794                                  var.title     ,795                                  var.xvar   () ,796                                  var.pars   () ,                              797                                  var.xmin   () ,798                                  var.xmax   () )799Ostap.MoreRooFit.Bernstein.  __reduce__  = _rbern_reduce800# =============================================================================801## Reduce <code>Ostap::MoreRooFit::Monotonic</code> object 802#  @see Ostap::MoreRooDit::Monotonic803def _rmono_reduce ( var ) :804    """Reduce `Ostap.MoreRooFit.Monotonic` object 805    - see Ostap.MoreRooDit.Monotonic806    """807    return root_store_factory , ( type ( var )  ,808                                  var.name      ,809                                  var.title     ,810                                  var.xvar ()   ,811                                  var.pars ()   ,                               812                                  var.monotonic().increasing() , 813                                  var.xmin ()   ,814                                  var.xmax ()   ,815                                  var.a    ()   ,816                                  var.b    ()   )817Ostap.MoreRooFit.Monotonic.  __reduce__  = _rmono_reduce818# =============================================================================819## Reduce <code>Ostap::MoreRooFit::Convex</code> object 820#  @see Ostap::MoreRooDit::Monotonic821def _rconv1_reduce ( var ) :822    """Reduce `Ostap.MoreRooFit.Monotonic` object 823    - see Ostap.MoreRooDit.Monotonic824    """825    return root_store_factory , ( type ( var )  ,826                                  var.name      ,827                                  var.title     ,828                                  var.xvar ()   ,829                                  var.pars ()   ,                               830                                  var.convex ().increasing () , 831                                  var.convex ().convex     () , 832                                  var.xmin ()   ,833                                  var.xmax ()   ,834                                  var.a    ()   ,835                                  var.b    ()   )836Ostap.MoreRooFit.Convex.  __reduce__  = _rconv1_reduce837# =============================================================================838## Reduce <code>Ostap::MoreRooFit::ConvexOnly</code> object 839#  @see Ostap::MoreRooDit::ConvexOnly840def _rconv2_reduce ( var ) :841    """Reduce `Ostap.MoreRooFit.ConvexOnly` object 842    - see Ostap.MoreRooDit.ConvexOnly843    """844    return root_store_factory , ( type ( var )  ,845                                  var.name      ,846                                  var.title     ,847                                  var.xvar ()   ,848                                  var.pars ()   ,                               849                                  var.convex ().convex () , 850                                  var.xmin ()   ,851                                  var.xmax ()   ,852                                  var.a    ()   ,853                                  var.b    ()   )854Ostap.MoreRooFit.ConvexOnly.  __reduce__  = _rconv2_reduce855# =============================================================================856## unpickle <code>Ostap::MoreRooFit::BSpline</code> objects857#  @see Ostap::MoreRooFit::BSpline858def _rbspl_factory ( klass , name , title , xvar , knots , pars ) :859    """unpickle `Ostap.MoreRooFit.BSpline` objects860    - see Ostap.MoreRooFit.BSpline861    """862    plst  = ROOT.RooArgList()863    for v in pars : plst.add ( v )864    knots = doubles ( knots )865    #866    obj        = klass ( name , title , xvar , knots , pars )867    obj.__args = pars ## ATTENTION HERE! keep the args! 868    return obj 869# =============================================================================870## Reduce <code>Ostap::MoreRooFit::BSpline</code> object 871#  @see Ostap::MoreRooDit::BSpline872def _rbspl_reduce ( spl ) :873    """Reduce `Ostap.MoreRooFit.BSpline` object 874    - see Ostap.MoreRooDit.BSpline875    """876    return _rbspl_factory, ( type ( spl ) ,877                             spl.name     ,878                             spl.title    ,879                             spl.xvar  () ,880                             array.array( 'd' , spl.knots() ) ,881                             spl.pars()   )882Ostap.MoreRooFit.BSpline.  __reduce__  = _rbspl_reduce883# ============================884## reduce <code>Ostap::Models::Uniform<code> object885#  @see Ostap::Models.Uniform 886def _runi_reduce_ ( uni ) :887    """reduce <code>Ostap::Models::Uniform<code> object888    - see Ostap::Models.Uniform 889    """890    tail = ()891    ##892    d = uni.dim() 893    if   1 == d : tail = uni.x() ,894    elif 2 == d : tail = uni.x() , uni.y()895    elif 3 == d : tail = uni.x() , uni.y() , uni.z()896    ##897    return root_store_factory , ( type ( uni ) ,898                                  uni.name     ,899                                  uni.title    ) + tail900Ostap.Models.Uniform.__reduce__ = _runi_reduce_901# =============================================================================902## reduce BreitWigner903def _rbw_reduce_ ( pdf ):904    """Reduce BreitWigner"""905    return root_store_factory , ( type ( pdf )       ,906                                  pdf.name           ,907                                  pdf.title          ,908                                  pdf.x      ()      , 909                                  pdf.mass   ()      ,910                                  pdf.widths ()[0]   ,911                                  pdf.breit_wigner() ) 912Ostap.Models.BreitWigner.__reduce__ = _rbw_reduce_ 913# =============================================================================914## reduce BreitWignerMC915def _rbwmc_reduce_ ( pdf ):916    """Reduce BreitWignerMC"""917    return root_store_factory , ( type ( pdf )          ,918                                  pdf.name              ,919                                  pdf.title             ,920                                  pdf.x      ()         , 921                                  pdf.mass   ()         ,922                                  pdf.widths ()         ,923                                  pdf.breit_wigner_MC() ) 924Ostap.Models.BreitWignerMC.__reduce__ = _rbwmc_reduce_ 925# =============================================================================926## reduce BWI927def _rbwi_reduce_ ( pdf ):928    """Reduce BWI"""929    return root_store_factory , ( type ( pdf )     ,930                                  pdf.name         ,931                                  pdf.title        ,932                                  pdf.original  () ,933                                  pdf.magnitude () ,934                                  pdf.phase     () ,935                                  pdf.scale1    () ,936                                  pdf.scale2    () )937Ostap.Models.BWI.__reduce__ = _rbwi_reduce_ 938# =============================================================================939## reduce Flatte940def _rflatte_reduce_ ( pdf ):941    """Reduce Flatte"""942    return root_store_factory , ( type ( pdf )     ,943                                  pdf.name         ,944                                  pdf.title        ,945                                  pdf.x      ()    , 946                                  pdf.mass   ()    ,947                                  pdf.widths ()[0] ,948                                  pdf.widths ()[1] ,949                                  pdf.widths ()[2] ,950                                  pdf.flatte  ()   ) 951Ostap.Models.Flatte.__reduce__ = _rflatte_reduce_ 952# =============================================================================953## reduce FlatteBugg954def _rflattebugg_reduce_ ( pdf ):955    """Reduce FlatteBugg"""956    return root_store_factory , ( type ( pdf )     ,957                                  pdf.name         ,958                                  pdf.title        ,959                                  pdf.x      ()    , 960                                  pdf.mass   ()    ,961                                  pdf.widths ()[0] ,962                                  pdf.widths ()[1] ,963                                  pdf.widths ()[2] ,964                                  pdf.flatte_bugg () ) 965Ostap.Models.FlatteBugg.__reduce__ = _rflattebugg_reduce_ 966# =============================================================================967## reduce LASS968def _rlass_reduce_ ( pdf ):969    """Reduce LASS"""970    return root_store_factory , ( type ( pdf )     ,971                                  pdf.name         ,972                                  pdf.title        ,973                                  pdf.x      ()    , 974                                  pdf.mass   ()    ,975                                  pdf.widths ()[0] ,976                                  pdf.a      ()    , 977                                  pdf.b      ()    , 978                                  pdf.e      ()    , 979                                  pdf.lass   ()    )980Ostap.Models.LASS.__reduce__ = _rlass_reduce_ 981# =============================================================================982## reduce BWPS983def _rbwps_reduce_ ( pdf ):984    """Reduce BWPS"""985    return root_store_factory , ( type ( pdf )     ,986                                  pdf.name         ,987                                  pdf.title        ,988                                  pdf.x      ()    , 989                                  pdf.mass   ()    ,990                                  pdf.widths ()    ,991                                  pdf.phis   ()    ,992                                  pdf.bwps   ()    )993Ostap.Models.BWPS.__reduce__ = _rbwps_reduce_ 994# =============================================================================995## reduce BW3L996def _rbw3l_reduce_ ( pdf ):997    """Reduce BW3L"""998    return root_store_factory , ( type ( pdf )     ,999                                  pdf.name         ,1000                                  pdf.title        ,1001                                  pdf.x      ()    , 1002                                  pdf.mass   ()    ,1003                                  pdf.widths ()    ,1004                                  pdf.bw3l   ()    )1005Ostap.Models.BW3L.__reduce__ = _rbw3l_reduce_ 1006# =============================================================================1007## reduce Voigt1008def _rvoigt_reduce_ ( pdf ):1009    """Reduce Voigt"""1010    return root_store_factory , ( type ( pdf )  ,1011                                  pdf.name      ,1012                                  pdf.title     ,1013                                  pdf.x      () , 1014                                  pdf.m0     () ,1015                                  pdf.gamma  () ,1016                                  pdf.sigma  () )1017Ostap.Models.Voigt      .__reduce__ = _rvoigt_reduce_ 1018Ostap.Models.PseudoVoigt.__reduce__ = _rvoigt_reduce_ 1019# =============================================================================1020## reduce CrystalBall1021def _rcb_reduce_ ( pdf ):1022    """Reduce CristalBall"""1023    return root_store_factory , ( type ( pdf )  ,1024                                  pdf.name      ,1025                                  pdf.title     ,1026                                  pdf.x      () , 1027                                  pdf.m0     () ,1028                                  pdf.sigma  () ,1029                                  pdf.alpha  () ,1030                                  pdf.n      () )1031Ostap.Models.CrystalBall   .__reduce__ = _rcb_reduce_ 1032Ostap.Models.CrystalBallRS .__reduce__ = _rcb_reduce_ 1033# =============================================================================1034## reduce CrystalBallDS1035def _rcb2_reduce_ ( pdf ):1036    """Reduce CristalBallDS"""1037    return root_store_factory , ( type ( pdf )  ,1038                                  pdf.name      ,1039                                  pdf.title     ,1040                                  pdf.x      () , 1041                                  pdf.m0     () ,1042                                  pdf.sigma  () ,1043                                  pdf.alphaL () ,1044                                  pdf.nL     () ,1045                                  pdf.alphaR () ,1046                                  pdf.nR     () )1047Ostap.Models.CrystalBallDS .__reduce__ = _rcb2_reduce_ 1048# =============================================================================1049## reduce Needham1050def _rneedham_reduce_ ( pdf ):1051    """Reduce Needham"""1052    return root_store_factory , ( type ( pdf )  ,1053                                  pdf.name      ,1054                                  pdf.title     ,1055                                  pdf.x      () , 1056                                  pdf.m0     () ,1057                                  pdf.sigma  () ,                            1058                                  pdf.a0     () ,1059                                  pdf.a1     () ,1060                                  pdf.a2     () )1061Ostap.Models.Needham .__reduce__ = _rneedham_reduce_ 1062# =============================================================================1063## reduce Apollonious1064def _rapo_reduce_ ( pdf ):1065    """Reduce Apollonios"""1066    return root_store_factory , ( type ( pdf )  ,1067                                  pdf.name      ,1068                                  pdf.title     ,1069                                  pdf.x      () , 1070                                  pdf.m0     () ,1071                                  pdf.sigma  () ,                            1072                                  pdf.alpha  () ,                            1073                                  pdf.n      () ,1074                                  pdf.b      () )1075Ostap.Models.Apollonios.__reduce__ = _rapo_reduce_ 1076# =============================================================================1077## reduce Apollonious21078def _rapo2_reduce_ ( pdf ):1079    """Reduce Apollonios2"""1080    return root_store_factory , ( type ( pdf )  ,1081                                  pdf.name      ,1082                                  pdf.title     ,1083                                  pdf.x      () , 1084                                  pdf.m0     () ,1085                                  pdf.sigmaL () ,                            1086                                  pdf.sigmaR () ,                            1087                                  pdf.beta   () )1088Ostap.Models.Apollonios2.__reduce__ = _rapo2_reduce_ 1089# =============================================================================1090## reduce BifurcatedGauss1091def _rgbf_reduce_ ( pdf ):1092    """Reduce BifurcatedGauss"""1093    return root_store_factory , ( type ( pdf )  ,1094                                  pdf.name      ,1095                                  pdf.title     ,1096                                  pdf.x      () , 1097                                  pdf.peak   () ,1098                                  pdf.sigmaL () ,                            1099                                  pdf.sigmaR () )1100Ostap.Models.BifurcatedGauss.__reduce__ = _rgbf_reduce_ 1101# =============================================================================1102## reduce GenGaussV11103def _rggv1_reduce_ ( pdf ):1104    """Reduce GenGaussV1"""1105    return root_store_factory , ( type ( pdf )  ,1106                                  pdf.name      ,1107                                  pdf.title     ,1108                                  pdf.x      () , 1109                                  pdf.mu     () ,1110                                  pdf.alpha  () ,                            1111                                  pdf.beta   () )1112Ostap.Models.GenGaussV1.__reduce__ = _rggv1_reduce_ 1113# =============================================================================1114## reduce GenGaussV21115def _rggv2_reduce_ ( pdf ):1116    """Reduce GenGaussV2"""1117    return root_store_factory , ( type ( pdf )  ,1118                                  pdf.name      ,1119                                  pdf.title     ,1120                                  pdf.x      () , 1121                                  pdf.xi     () ,1122                                  pdf.alpha  () ,                            1123                                  pdf.kappa  () )1124Ostap.Models.GenGaussV2.__reduce__ = _rggv2_reduce_ 1125# =============================================================================1126## reduce SkewGauss1127def _rskg_reduce_ ( pdf ):1128    """Reduce SkewGauss"""1129    return root_store_factory , ( type ( pdf )    ,1130                                  pdf.name        ,1131                                  pdf.title       ,1132                                  pdf.x        () , 1133                                  pdf.xi       () ,1134                                  pdf.omega    () ,                            1135                                  pdf.alpha    () )1136Ostap.Models.SkewGauss.__reduce__ = _rskg_reduce_ 1137# =============================================================================1138## reduce ExGauss1139def _rexg_reduce_ ( pdf ):1140    """Reduce ExGauss"""1141    return root_store_factory , ( type ( pdf )    ,1142                                  pdf.name        ,1143                                  pdf.title       ,1144                                  pdf.x        () , 1145                                  pdf.mu       () ,1146                                  pdf.varsigma () ,                            1147                                  pdf.k        () )1148Ostap.Models.ExGauss.__reduce__ = _rexg_reduce_ 1149# =============================================================================1150## reduce NormalLaplace1151def _rnl_reduce_ ( pdf ):1152    """Reduce NormalLaplace"""1153    return root_store_factory , ( type ( pdf )    ,1154                                  pdf.name        ,1155                                  pdf.title       ,1156                                  pdf.x        () , 1157                                  pdf.mu       () ,1158                                  pdf.varsigma () ,                            1159                                  pdf.kL       () ,1160                                  pdf.kL       () )1161Ostap.Models.NormalLaplace.__reduce__ = _rnl_reduce_ 1162# =============================================================================1163## reduce Novosibirsk1164def _rnovo_reduce_ ( pdf ):1165    """Reduce Novisibirsk"""1166    return root_store_factory , ( type ( pdf )  ,1167                                  pdf.name      ,1168                                  pdf.title     ,1169                                  pdf.x      () , 1170                                  pdf.peak   () ,1171                                  pdf.sigma  () ,                            1172                                  pdf.tau    () )1173Ostap.Models.Novosibirsk.__reduce__ = _rnovo_reduce_ 1174# =============================================================================1175## reduce Bukin1176def _rbukin_reduce_ ( pdf ):1177    """Reduce Bukin"""1178    return root_store_factory , ( type ( pdf )  ,1179                                  pdf.name      ,1180                                  pdf.title     ,1181                                  pdf.x      () , 1182                                  pdf.peak   () ,1183                                  pdf.sigma  () ,                            1184                                  pdf.xi     () ,1185                                  pdf.rhoL   () ,1186                                  pdf.rhoR   () )1187Ostap.Models.Bukin.__reduce__ = _rbukin_reduce_ 1188# =============================================================================1189## reduce StudentT1190def _rstt_reduce_ ( pdf ):1191    """Reduce StudentT"""1192    return root_store_factory , ( type ( pdf )  ,1193                                  pdf.name      ,1194                                  pdf.title     ,1195                                  pdf.x      () , 1196                                  pdf.mu     () ,1197                                  pdf.sigma  () ,                            1198                                  pdf.n      () )1199Ostap.Models.StudentT.__reduce__ = _rstt_reduce_ 1200# =============================================================================1201## reduce BifurcatedStudentT1202def _rbstt_reduce_ ( pdf ):1203    """Reduce BifurcatedStudentT"""1204    return root_store_factory , ( type ( pdf )  ,1205                                  pdf.name      ,1206                                  pdf.title     ,1207                                  pdf.x      () , 1208                                  pdf.mu     () ,1209                                  pdf.sigmaL () ,                            1210                                  pdf.sigmaR () ,                            1211                                  pdf.nL     () ,1212                                  pdf.nR     () )1213Ostap.Models.BifurcatedStudentT.__reduce__ = _rbstt_reduce_ 1214# =============================================================================1215## reduce PearsonIV1216def _rp4_reduce_ ( pdf ):1217    """Reduce PearsonIV"""1218    return root_store_factory , ( type ( pdf )    ,1219                                  pdf.name        ,1220                                  pdf.title       ,1221                                  pdf.x        () , 1222                                  pdf.mu       () ,1223                                  pdf.varsigma () ,                            1224                                  pdf.n        () ,                            1225                                  pdf.kappa    () )1226Ostap.Models.PearsonIV.__reduce__ = _rp4_reduce_ 1227# =============================================================================1228## reduce GramCharlierA1229def _rgca_reduce_ ( pdf ):1230    """Reduce GramCharlierA"""1231    return root_store_factory , ( type ( pdf )    ,1232                                  pdf.name        ,1233                                  pdf.title       ,1234                                  pdf.x        () , 1235                                  pdf.mu       () ,1236                                  pdf.sigma    () ,                            1237                                  pdf.kappa3   () ,1238                                  pdf.kappa4   () )1239Ostap.Models.GramCharlierA.__reduce__ = _rgca_reduce_ 1240# =============================================================================1241## reduce PhaseSpace21242def _rps2_reduce_ ( pdf ):1243    """Reduce PhaseSpace2"""1244    return root_store_factory , ( type ( pdf )    ,1245                                  pdf.name        ,1246                                  pdf.title       ,1247                                  pdf.x        () , 1248                                  pdf.m1       () ,1249                                  pdf.m2       () )1250Ostap.Models.PhaseSpace2.__reduce__ = _rps2_reduce_ 1251# =============================================================================1252## reduce PhaseSpaceLeft1253def _rpsl_reduce_ ( pdf ):1254    """Reduce PhaseSpaceLeft"""1255    return root_store_factory , ( type ( pdf )     ,1256                                  pdf.name         ,1257                                  pdf.title        ,1258                                  pdf.x         () , 1259                                  pdf.threshold () ,1260                                  pdf.scale     () ,1261                                  pdf.left      () )1262Ostap.Models.PhaseSpaceLeft.__reduce__ = _rpsl_reduce_ 1263# =============================================================================1264## reduce PhaseSpaceRight1265def _rpsr_reduce_ ( pdf ):1266    """Reduce PhaseSpaceRight"""1267    return root_store_factory , ( type ( pdf )     ,1268                                  pdf.name         ,1269                                  pdf.title        ,1270                                  pdf.x         () , 1271                                  pdf.threshold () ,1272                                  pdf.L         () ,1273                                  pdf.N         () )1274Ostap.Models.PhaseSpaceRight.__reduce__ = _rpsr_reduce_ 1275# =============================================================================1276## reduce PhaseSpaceNL1277def _rpsnl_reduce_ ( pdf ):1278    """Reduce PhaseSpaceNL"""1279    return root_store_factory , ( type ( pdf )     ,1280                                  pdf.name         ,1281                                  pdf.title        ,1282                                  pdf.x         () , 1283                                  pdf.low       () ,1284                                  pdf.high      () ,1285                                  pdf.N         () ,1286                                  pdf.L         () )1287Ostap.Models.PhaseSpaceNL.__reduce__ = _rpsnl_reduce_ 1288# =============================================================================1289## reduce PhaseSpacePol1290def _rpspol_reduce_ ( pdf ):1291    """Reduce PhaseSpacePol"""1292    return root_store_factory , ( type ( pdf )     ,1293                                  pdf.name         ,1294                                  pdf.title        ,1295                                  pdf.x         () , 1296                                  pdf.psNL      () ,1297                                  pdf.phis      () )1298Ostap.Models.PhaseSpacePol.__reduce__ = _rpspol_reduce_ 1299# =============================================================================1300## reduce PhaseSpaceLeftExpoPol1301def _rpslepol_reduce_ ( pdf ):1302    """Reduce PhaseSpaceLeftExpoPol"""1303    return root_store_factory , ( type ( pdf )     ,1304                                  pdf.name         ,1305                                  pdf.title        ,1306                                  pdf.x         () , 1307                                  pdf.psleft    () ,1308                                  pdf.tau       () ,1309                                  pdf.scale     () ,1310                                  pdf.phis      () )1311Ostap.Models.PhaseSpaceLeftExpoPol.__reduce__ = _rpslepol_reduce_ 1312## PhaseSpace23L - not done .... why?1313# =============================================================================1314## reduce PolyPositive 1315def _rpolpos_reduce_ ( pdf ):1316    """Reduce PolyPositive"""1317    return root_store_factory , ( type ( pdf )     ,1318                                  pdf.name         ,1319                                  pdf.title        ,1320                                  pdf.x         () , 1321                                  pdf.phis      () ,1322                                  pdf.xmin      () ,1323                                  pdf.xmax      () )1324Ostap.Models.PolyPositive.__reduce__ = _rpolpos_reduce_1325# =============================================================================1326## reduce PolyPositiveEven 1327def _rpolpose_reduce_ ( pdf ):1328    """Reduce PolyPositiveEven"""1329    return root_store_factory , ( type ( pdf )     ,1330                                  pdf.name         ,1331                                  pdf.title        ,1332                                  pdf.x         () , 1333                                  pdf.phis      () ,1334                                  pdf.xmin      () ,1335                                  pdf.xmax      () )1336Ostap.Models.PolyPositiveEven.__reduce__ = _rpolpose_reduce_ 1337# =============================================================================1338## reduce PolyMonotonic1339def _rpolmon_reduce_ ( pdf ):1340    """Reduce PolyMonotonic"""1341    return root_store_factory , ( type ( pdf )      ,1342                                  pdf.name          ,1343                                  pdf.title         ,1344                                  pdf.x          () , 1345                                  pdf.phis       () ,1346                                  pdf.xmin       () ,1347                                  pdf.xmax       () ,1348                                  pdf.increasing () )1349Ostap.Models.PolyMonotonic.__reduce__ = _rpolmon_reduce_ 1350# =============================================================================1351## reduce PolyConvex1352def _rpolcon_reduce_ ( pdf ):1353    """Reduce PolyConvex"""1354    return root_store_factory , ( type ( pdf )      ,1355                                  pdf.name          ,1356                                  pdf.title         ,1357                                  pdf.x          () , 1358                                  pdf.phis       () ,1359                                  pdf.xmin       () ,1360                                  pdf.xmax       () ,1361                                  pdf.increasing () ,1362                                  pdf.convex     () )1363Ostap.Models.PolyConvex.__reduce__ = _rpolcon_reduce_ 1364# =============================================================================1365## reduce PolyConvexOnly1366def _rpolcono_reduce_ ( pdf ):1367    """Reduce PolyConvexOnly"""1368    return root_store_factory , ( type ( pdf )      ,1369                                  pdf.name          ,1370                                  pdf.title         ,1371                                  pdf.x          () , 1372                                  pdf.phis       () ,1373                                  pdf.xmin       () ,1374                                  pdf.xmax       () ,1375                                  pdf.convex     () )1376Ostap.Models.PolyConvexOnly.__reduce__ = _rpolcono_reduce_ 1377# =============================================================================1378## reduce ExpoPositive1379def _rexppos_reduce_ ( pdf ):1380    """Reduce ExpoPoisitive"""1381    return root_store_factory , ( type ( pdf )      ,1382                                  pdf.name          ,1383                                  pdf.title         ,1384                                  pdf.x          () , 1385                                  pdf.tau        () ,1386                                  pdf.phis       () ,1387                                  pdf.xmin       () ,1388                                  pdf.xmax       () )1389Ostap.Models.ExpoPositive.__reduce__ = _rexppos_reduce_ 1390# =============================================================================1391## reduce PolySigmoid1392def _rpolsigm_reduce_ ( pdf ):1393    """Reduce PoLySigmoid"""1394    return root_store_factory , ( type ( pdf )      ,1395                                  pdf.name          ,1396                                  pdf.title         ,1397                                  pdf.x          () , 1398                                  pdf.phis       () ,1399                                  pdf.xmin       () ,1400                                  pdf.xmax       () ,1401                                  pdf.alpha      () ,1402                                  pdf.x0         () )1403Ostap.Models.PolySigmoid.__reduce__ = _rpolsigm_reduce_ 1404# =============================================================================1405## reduce TwoExpoPositive1406def _r2exppos_reduce_ ( pdf ):1407    """Reduce TwoExpoPositive"""1408    return root_store_factory , ( type ( pdf )      ,1409                                  pdf.name          ,1410                                  pdf.title         ,1411                                  pdf.x          () ,                            1412                                  pdf.alpha      () ,1413                                  pdf.delta      () ,1414                                  pdf.x0         () ,1415                                  pdf.phis       () ,1416                                  pdf.xmin       () ,1417                                  pdf.xmax       () )1418Ostap.Models.TwoExpoPositive.__reduce__ = _r2exppos_reduce_ 1419# =============================================================================1420## reduce GammaDist1421def _rgamdist_reduce_ ( pdf ):1422    """Reduce GammaDist"""1423    return root_store_factory , ( type ( pdf )      ,1424                                  pdf.name          ,1425                                  pdf.title         ,1426                                  pdf.x          () ,                            1427                                  pdf.k          () ,1428                                  pdf.theta      () )1429Ostap.Models.GammaDist     .__reduce__ = _rgamdist_reduce_ 1430Ostap.Models.LogGammaDist  .__reduce__ = _rgamdist_reduce_ 1431Ostap.Models.Log10GammaDist.__reduce__ = _rgamdist_reduce_ 1432# =============================================================================1433## reduce GenGammaDist1434def _rggamdist_reduce_ ( pdf ):1435    """Reduce GenGammaDist"""1436    return root_store_factory , ( type ( pdf )      ,1437                                  pdf.name          ,1438                                  pdf.title         ,1439                                  pdf.x          () ,                            1440                                  pdf.k          () ,1441                                  pdf.theta      () ,1442                                  pdf.p          () ,1443                                  pdf.low        () )1444Ostap.Models.GenGammaDist.__reduce__ = _rggamdist_reduce_ 1445# =============================================================================1446## reduce Amoroso1447def _ramoroso_reduce_ ( pdf ):1448    """Reduce Amoroso"""1449    return root_store_factory , ( type ( pdf )      ,1450                                  pdf.name          ,1451                                  pdf.title         ,1452                                  pdf.x          () ,                            1453                                  pdf.theta      () ,1454                                  pdf.alpha      () ,1455                                  pdf.beta       () ,1456                                  pdf.a          () )1457Ostap.Models.Amoroso.__reduce__ = _ramoroso_reduce_ 1458# =============================================================================1459## reduce LogGamma1460def _rloggam_reduce_ ( pdf ):1461    """Reduce LogGamma"""1462    return root_store_factory , ( type ( pdf )      ,1463                                  pdf.name          ,1464                                  pdf.title         ,1465                                  pdf.x          () ,                            1466                                  pdf.nu         () ,1467                                  pdf.lambd      () ,1468                                  pdf.alpha      () )1469Ostap.Models.LogGamma   .__reduce__ = _rloggam_reduce_ 1470# =============================================================================1471## reduce BetaPrime1472def _rbetap_reduce_ ( pdf ):1473    """Reduce BetaPrime"""1474    return root_store_factory , ( type ( pdf )      ,1475                                  pdf.name          ,1476                                  pdf.title         ,1477                                  pdf.x          () ,                            1478                                  pdf.alpha      () ,1479                                  pdf.beta       () ,1480                                  pdf.scale      () ,1481                                  pdf.shift      () )1482Ostap.Models.BetaPrime.__reduce__ = _rbetap_reduce_ 1483# =============================================================================1484## reduce Landau1485def _rlandau_reduce_ ( pdf ):1486    """Reduce Landau"""1487    return root_store_factory , ( type ( pdf )      ,1488                                  pdf.name          ,1489                                  pdf.title         ,1490                                  pdf.x          () ,                            1491                                  pdf.scale      () ,1492                                  pdf.shift      () )1493Ostap.Models.Landau.__reduce__ = _rlandau_reduce_ 1494# =============================================================================1495## reduce SinhAsinh1496def _rshash_reduce_ ( pdf ):1497    """Reduce SinhAsinh"""1498    return root_store_factory , ( type ( pdf )   ,1499                                  pdf.name       ,1500                                  pdf.title      ,1501                                  pdf.x       () ,                            1502                                  pdf.mu      () ,1503                                  pdf.sigma   () ,1504                                  pdf.epsilon () ,1505                                  pdf.delta   () )1506Ostap.Models.SinhAsinh.__reduce__ = _rshash_reduce_ 1507# =============================================================================1508## reduce JohnsonSU1509def _rjsu_reduce_ ( pdf ):1510    """Reduce JohnsonSU"""1511    return root_store_factory , ( type ( pdf )   ,1512                                  pdf.name       ,1513                                  pdf.title      ,1514                                  pdf.x       () ,                            1515                                  pdf.xi      () ,1516                                  pdf.lambd   () ,1517                                  pdf.delta   () ,1518                                  pdf.gamma   () )1519Ostap.Models.JohnsonSU.__reduce__ = _rjsu_reduce_ 1520# =============================================================================1521## reduce ATLAS1522def _ratlas_reduce_ ( pdf ):1523    """Reduce Atlas"""1524    return root_store_factory , ( type ( pdf )   ,1525                                  pdf.name       ,1526                                  pdf.title      ,1527                                  pdf.x       () ,                            1528                                  pdf.mu      () ,1529                                  pdf.sigma   () )1530Ostap.Models.Atlas    .__reduce__ = _ratlas_reduce_ 1531Ostap.Models.Sech     .__reduce__ = _ratlas_reduce_ 1532Ostap.Models.Logistic .__reduce__ = _ratlas_reduce_ 1533Ostap.Models.Hat      .__reduce__ = _ratlas_reduce_ 1534Ostap.Models.Up       .__reduce__ = _ratlas_reduce_ 1535# =============================================================================1536## reduce Slash1537def _rslash_reduce_ ( pdf ):1538    """Reduce Slasj"""1539    return root_store_factory , ( type ( pdf )   ,1540                                  pdf.name       ,1541                                  pdf.title      ,1542                                  pdf.x       () ,                            1543                                  pdf.mu      () ,1544                                  pdf.scale   () )1545Ostap.Models.Slash    .__reduce__ = _rslash_reduce_ 1546# =============================================================================1547## reduce ARGUS1548def _rargus_reduce_ ( pdf ):1549    """Reduce ARGUS"""1550    return root_store_factory , ( type ( pdf )   ,1551                                  pdf.name       ,1552                                  pdf.title      ,1553                                  pdf.x       () ,                            1554                                  pdf.mu      () ,1555                                  pdf.c       () ,1556                                  pdf.chi     () )1557Ostap.Models.Argus  .__reduce__ = _rargus_reduce_ 1558# =============================================================================1559## reduce GenArgus1560def _rgargus_reduce_ ( pdf ):1561    """Reduce GenArgus"""1562    return root_store_factory , ( type ( pdf )   ,1563                                  pdf.name       ,1564                                  pdf.title      ,1565                                  pdf.x       () ,                            1566                                  pdf.mu      () ,1567                                  pdf.c       () ,1568                                  pdf.chi     () ,1569                                  pdf.dp     () )1570Ostap.Models.GenArgus .__reduce__ = _rgargus_reduce_ 1571# =============================================================================1572## reduce Losev1573def _rlosev_reduce_ ( pdf ):1574    """Reduce Losev"""1575    return root_store_factory , ( type ( pdf )   ,1576                                  pdf.name       ,1577                                  pdf.title      ,1578                                  pdf.x       () ,                            1579                                  pdf.mu      () ,1580                                  pdf.alpha   () ,1581                                  pdf.beta    () )1582Ostap.Models.Losev.__reduce__ = _rlosev_reduce_ 1583# =============================================================================1584## reduce AsymmetricLaplace1585def _ralap_reduce_ ( pdf ):1586    """Reduce AsymmetricLaplace"""1587    return root_store_factory , ( type ( pdf )   ,1588                                  pdf.name       ,1589                                  pdf.title      ,1590                                  pdf.x       () ,                            1591                                  pdf.mu      () ,1592                                  pdf.lambdaL () ,1593                                  pdf.lambdaR () )1594Ostap.Models.AsymmetricLaplace.__reduce__ = _ralap_reduce_ 1595# =============================================================================1596## reduce FupN1597def _rfupn_reduce_ ( pdf ):1598    """Reduce FupN"""1599    return root_store_factory , ( type ( pdf )    ,1600                                  pdf.name        ,1601                                  pdf.title       ,1602                                  pdf.x        () ,                            1603                                  pdf.N        () ,                            1604                                  pdf.mu       () ,1605                                  pdf.varsigma () )1606Ostap.Models.FupN.__reduce__ = _rfupn_reduce_ 1607# =============================================================================1608## reduce Tsallis1609def _rtsal_reduce_ ( pdf ):1610    """Reduce Tsallis"""1611    return root_store_factory , ( type ( pdf )    ,1612                                  pdf.name        ,1613                                  pdf.title       ,1614                                  pdf.pt       () ,                            1615                                  pdf.N        () ,                            1616                                  pdf.T        () ,1617                                  pdf.mass     () )1618Ostap.Models.Tsallis.__reduce__ = _rtsal_reduce_ 1619# =============================================================================1620## reduce QGSM1621def _rqgsm_reduce_ ( pdf ):1622    """Reduce QGSM"""1623    return root_store_factory , ( type ( pdf )    ,1624                                  pdf.name        ,1625                                  pdf.title       ,1626                                  pdf.x        () ,                            1627                                  pdf.b        () ,                            1628                                  pdf.mass     () )1629Ostap.Models.QGSM.__reduce__ = _rqgsm_reduce_ 1630# =============================================================================1631## reduce Tsallis21632def _rtsal2_reduce_ ( pdf ):1633    """Reduce Tsallis2"""1634    return root_store_factory , ( type ( pdf )    ,1635                                  pdf.name        ,1636                                  pdf.title       ,1637                                  pdf.pt       () ,                            1638                                  pdf.y        () ,                            1639                                  pdf.mass     () ,                            1640                                  pdf.T        () ,1641                                  pdf.q        () ,1642                                  pdf.mu       () )1643Ostap.Models.Tsallis2.__reduce__ = _rtsal2_reduce_ 1644# =============================================================================1645## reduce TwoExpos1646def _r2expo_reduce_ ( pdf ):1647    """Reduce TwoExpos"""1648    return root_store_factory , ( type ( pdf )    ,1649                                  pdf.name        ,1650                                  pdf.title       ,1651                                  pdf.x        () ,                            1652                                  pdf.alpha    () ,                            1653                                  pdf.delta    () ,1654                                  pdf.x0       () )1655Ostap.Models.TwoExpos.__reduce__ = _r2expo_reduce_ 1656# =============================================================================1657## reduce DoubleGauss1658def _r2gau_reduce_ ( pdf ):1659    """Reduce DoubleGauss"""1660    return root_store_factory , ( type ( pdf )    ,1661                                  pdf.name        ,1662                                  pdf.title       ,1663                                  pdf.x        () ,                            1664                                  pdf.sigma    () ,                            1665                                  pdf.fraction () ,1666                                  pdf.scale    () ,1667                                  pdf.mean     () )1668Ostap.Models.DoubleGauss.__reduce__ = _r2gau_reduce_ 1669# =============================================================================1670## reduce Gumbel1671def _rgumbel_reduce_ ( pdf ):1672    """Reduce Gumbel"""1673    return root_store_factory , ( type ( pdf )    ,1674                                  pdf.name        ,1675                                  pdf.title       ,1676                                  pdf.x        () ,                            1677                                  pdf.mu       () ,                            1678                                  pdf.beta     () )1679Ostap.Models.Gumbel.__reduce__ = _rgumbel_reduce_ 1680# =============================================================================1681## reduce Weibull1682def _rweibull_reduce_ ( pdf ):1683    """Reduce Weibull"""1684    return root_store_factory , ( type ( pdf )    ,1685                                  pdf.name        ,1686                                  pdf.title       ,1687                                  pdf.x        () ,                            1688                                  pdf.scale    () ,                            1689                                  pdf.shape    () ,1690                                  pdf.shift    () )1691Ostap.Models.Weibull.__reduce__ = _rweibull_reduce_ 1692# =============================================================================1693## reduce Rice1694def _rrice_reduce_ ( pdf ):1695    """Reduce Rice"""1696    return root_store_factory , ( type ( pdf )    ,1697                                  pdf.name         ,1698                                  pdf.title        ,1699                                  pdf.x         () ,                            1700                                  pdf.nu        () ,                            1701                                  pdf.varshigma () ,1702                                  pdf.shift     () )1703Ostap.Models.Rice.__reduce__ = _rrice_reduce_ 1704# =============================================================================1705## reduce RasingCosine 1706def _rrcos_reduce_ ( pdf ):1707    """Reduce RaisingCosine"""1708    return root_store_factory , ( type ( pdf )    ,1709                                  pdf.name        ,1710                                  pdf.title       ,1711                                  pdf.x        () ,                            1712                                  pdf.mean     () ,                            1713                                  pdf.scale    () )1714Ostap.Models.RaisingCosine.__reduce__ = _rrcos_reduce_ 1715# =============================================================================1716## reduce q-Gaussian1717def _rqgau_reduce_ ( pdf ):1718    """Reduce QGaussian"""1719    return root_store_factory , ( type ( pdf )    ,1720                                  pdf.name        ,1721                                  pdf.title       ,1722                                  pdf.x        () ,                            1723                                  pdf.mean     () ,                            1724                                  pdf.scale    () ,1725                                  pdf.q        () )1726Ostap.Models.QGaussian.__reduce__ = _rqgau_reduce_ 1727# =============================================================================1728## reduce Hyperbolic1729def _rhyp_reduce_ ( pdf ):1730    """Reduce Hyperbolic"""1731    return root_store_factory , ( type ( pdf )    ,1732                                  pdf.name        ,1733                                  pdf.title       ,1734                                  pdf.x        () ,                            1735                                  pdf.mu       () ,                            1736                                  pdf.sigma    () ,1737                                  pdf.zeta     () ,1738                                  pdf.kappa    () )1739Ostap.Models.Hyperbolic.__reduce__ = _rhyp_reduce_ 1740# =============================================================================1741## reduce GenHyperbolic1742def _rghyp_reduce_ ( pdf ):1743    """Reduce GenHyperbolic"""1744    return root_store_factory , ( type ( pdf )    ,1745                                  pdf.name        ,1746                                  pdf.title       ,1747                                  pdf.x        () ,                            1748                                  pdf.mu       () ,                            1749                                  pdf.sigma    () ,1750                                  pdf.zeta     () ,1751                                  pdf.kappa    () ,1752                                  pdf.lambd    () )1753Ostap.Models.GenHyperbolic.__reduce__ = _rghyp_reduce_ 1754# =============================================================================1755## reduce Das1756def _rdas_reduce_ ( pdf ):1757    """Reduce Das"""1758    return root_store_factory , ( type ( pdf )    ,1759                                  pdf.name        ,1760                                  pdf.title       ,1761                                  pdf.x        () ,                            1762                                  pdf.mu       () ,                            1763                                  pdf.sigma    () ,1764                                  pdf.kL       () ,1765                                  pdf.kR       () )1766Ostap.Models.Das.__reduce__ = _rdas_reduce_ 1767# =============================================================================1768## reduce GenInvGauss1769def _rgig_reduce_ ( pdf ):1770    """Reduce GenInvGauss"""1771    return root_store_factory , ( type ( pdf )  ,1772                                  pdf.name      ,1773                                  pdf.title     ,1774                                  pdf.x      () ,                            1775                                  pdf.theta  () ,                            1776                                  pdf.eta    () ,1777                                  pdf.p      () ,1778                                  pdf.shift  () )1779Ostap.Models.GenInvGauss.__reduce__ = _rgig_reduce_ 1780# =============================================================================1781## reduce PositiveSpline 1782def _rsplpos_reduce_ ( pdf ):1783    """Reduce PositiveSpline"""1784    return root_store_factory , ( type ( pdf )    ,1785                                  pdf.name        ,1786                                  pdf.title       ,1787                                  pdf.x        () ,                            1788                                  pdf.spline   () ,                            1789                                  pdf.phis     () )1790Ostap.Models.PositiveSpline   .__reduce__ = _rsplpos_reduce_ 1791Ostap.Models.MonotonicSpline  .__reduce__ = _rsplpos_reduce_ 1792Ostap.Models.ConvexSpline     .__reduce__ = _rsplpos_reduce_ 1793Ostap.Models.ConvexOnlySpline .__reduce__ = _rsplpos_reduce_ 1794# =============================================================================1795## reduce HORNSdini1796def _rdini_reduce_ ( pdf ):1797    """Reduce HORNSdini"""1798    return root_store_factory , ( type ( pdf )  ,1799                                  pdf.name      ,1800                                  pdf.title     ,1801                                  pdf.x      () ,                            1802                                  pdf.a      () ,                            1803                                  pdf.delta  () ,1804                                  pdf.phi    () )1805Ostap.Models.HORNSdini.__reduce__ = _rdini_reduce_ 1806Ostap.Models.HILLdini .__reduce__ = _rdini_reduce_ 1807# =============================================================================1808## reduce Histo1D1809def _rh1d_reduce_ ( pdf ) :1810    """reduce Histo1D"""1811    return root_store_factory , ( type ( pdf )  ,1812                                  pdf.name      ,1813                                  pdf.title     ,1814                                  pdf.x      () ,                            1815                                  pdf.histo  () )1816Ostap.Models.Histo1D.__reduce__ = _rh1d_reduce_ 1817# =============================================================================1818## reduce Histo2D1819def _rh2d_reduce_ ( pdf ) :1820    """reduce Histo2D"""1821    return root_store_factory , ( type ( pdf )  ,1822                                  pdf.name      ,1823                                  pdf.title     ,1824                                  pdf.x      () ,                            1825                                  pdf.y      () ,                            1826                                  pdf.histo  () )1827Ostap.Models.Histo2D.__reduce__ = _rh2d_reduce_ 1828# =============================================================================1829## reduce Histo3D1830def _rh3d_reduce_ ( pdf ) :1831    """reduce Histo3D"""1832    return root_store_factory , ( type ( pdf )  ,1833                                  pdf.name      ,1834                                  pdf.title     ,1835                                  pdf.x      () ,                            1836                                  pdf.y      () ,                            1837                                  pdf.z      () ,                            1838                                  pdf.histo  () )1839Ostap.Models.Histo3D.__reduce__ = _rh3d_reduce_ 1840# =============================================================================1841## reduce CutoffGauss1842def _rcutgau_reduce_ ( pdf ):1843    """Reduce CutOffGauss"""1844    return root_store_factory , ( type ( pdf )    ,1845                                  pdf.name        ,1846                                  pdf.title       ,1847                                  pdf.x        () ,                            1848                                  pdf.x0       () ,                            1849                                  pdf.sigma    () ,1850                                  pdf.cutoff   () )1851Ostap.Models.CutOffGauss.__reduce__ = _rcutgau_reduce_ 1852# =============================================================================1853## reduce CutoffStudent1854def _rcutstt_reduce_ ( pdf ):1855    """Reduce CutOffStudent"""1856    return root_store_factory , ( type ( pdf )    ,1857                                  pdf.name        ,1858                                  pdf.title       ,1859                                  pdf.x        () ,                            1860                                  pdf.x0       () ,                            1861                                  pdf.nu       () ,1862                                  pdf.sigma    () ,1863                                  pdf.cutoff   () )1864Ostap.Models.CutOffStudent.__reduce__ = _rcutstt_reduce_ 1865# =============================================================================1866##  2D PDFs1867# =============================================================================1868# =============================================================================1869## reduce Poly2DPositive1870def _rpol2d_reduce_ ( pdf ):1871    """Reduce Poly2DPositive"""1872    return root_store_factory , ( type ( pdf )    ,1873                                  pdf.name        ,1874                                  pdf.title       ,1875                                  pdf.x        () ,                            1876                                  pdf.y        () ,                            1877                                  pdf.nX       () ,                            1878                                  pdf.nY       () ,1879                                  pdf.phis     () )1880Ostap.Models.Poly2DPositive.__reduce__ = _rpol2d_reduce_ 1881# =============================================================================1882## reduce Poly2DSymPositive1883def _rpol2ds_reduce_ ( pdf ):1884    """Reduce Poly2DSymPositive"""1885    return root_store_factory , ( type ( pdf )    ,1886                                  pdf.name        ,1887                                  pdf.title       ,1888                                  pdf.x        () ,                            1889                                  pdf.y        () ,                            1890                                  pdf.n        () ,                            1891                                  pdf.phis     () )1892Ostap.Models.Poly2DSymPositive.__reduce__ = _rpol2ds_reduce_ 1893# =============================================================================1894## reduce PS2DPol1895def _rps2dpol_reduce_ ( pdf ):1896    """Reduce PS2DPol"""1897    return root_store_factory , ( type ( pdf )    ,1898                                  pdf.name        ,1899                                  pdf.title       ,1900                                  pdf.x        () ,                            1901                                  pdf.y        () ,1902                                  pdf.psX      () ,                            1903                                  pdf.psY      () ,                            1904                                  pdf.nX       () ,                            1905                                  pdf.nX       () ,                            1906                                  pdf.phis     () )1907Ostap.Models.PS2DPol.__reduce__ = _rps2dpol_reduce_ 1908# =============================================================================1909## reduce PS2DPolSym1910def _rps2dpols_reduce_ ( pdf ):1911    """Reduce PS2DPolSym"""1912    return root_store_factory , ( type ( pdf )    ,1913                                  pdf.name        ,1914                                  pdf.title       ,1915                                  pdf.x        () ,                            1916                                  pdf.y        () ,1917                                  pdf.psX      () ,                            1918                                  pdf.n        () ,                            1919                                  pdf.phis     () )1920Ostap.Models.PS2DPolSym.__reduce__ = _rps2dpols_reduce_ 1921# =============================================================================1922## reduce PS2DPol21923def _rps2dpol2_reduce_ ( pdf ):1924    """Reduce PS2DPol2"""1925    return root_store_factory , ( type ( pdf )    ,1926                                  pdf.name        ,1927                                  pdf.title       ,1928                                  pdf.x        () ,                            1929                                  pdf.y        () ,1930                                  pdf.psX      () ,                            1931                                  pdf.psY      () ,                            1932                                  pdf.mmax     () ,                            1933                                  pdf.nX       () ,                            1934                                  pdf.nY       () ,                            1935                                  pdf.phis     () )1936Ostap.Models.PS2DPol2.__reduce__ = _rps2dpol2_reduce_ 1937Ostap.Models.PS2DPol3.__reduce__ = _rps2dpol2_reduce_ 1938# =============================================================================1939## reduce PS2DPol2Sym1940def _rps2dpol2s_reduce_ ( pdf ):1941    """Reduce PS2DPol2Sym"""1942    return root_store_factory , ( type ( pdf )    ,1943                                  pdf.name        ,1944                                  pdf.title       ,1945                                  pdf.x        () ,                            1946                                  pdf.y        () ,1947                                  pdf.psX      () ,                            1948                                  pdf.mmax     () ,                            1949                                  pdf.nX       () ,                            1950                                  pdf.phis     () )1951Ostap.Models.PS2DPol2Sym.__reduce__ = _rps2dpol2s_reduce_ 1952Ostap.Models.PS2DPol3Sym.__reduce__ = _rps2dpol2s_reduce_ 1953# =============================================================================1954## Reduce Expo2DPol1955def _rexp2d_reduce_ ( pdf ):1956    """Reduce Expo2DPol"""1957    return root_store_factory , ( type ( pdf )    ,1958                                  pdf.name        ,1959                                  pdf.title       ,1960                                  pdf.x        () ,                            1961                                  pdf.y        () ,1962                                  pdf.taux     () ,                            1963                                  pdf.tauy     () ,                            1964                                  pdf.nX       () ,                            1965                                  pdf.nY       () ,                            1966                                  pdf.phis     () )1967Ostap.Models.Expo2DPol.__reduce__ = _rexp2d_reduce_ 1968# =============================================================================1969## Reduce Expo2DPolSym1970def _rexp2ds_reduce_ ( pdf ):1971    """Reduce Expo2DPolSym"""1972    return root_store_factory , ( type ( pdf )    ,1973                                  pdf.name        ,1974                                  pdf.title       ,1975                                  pdf.x        () ,                            1976                                  pdf.y        () ,1977                                  pdf.tau      () ,                            1978                                  pdf.nX       () ,                            1979                                  pdf.phis     () )1980Ostap.Models.Expo2DPolSym.__reduce__ = _rexp2ds_reduce_ 1981# =============================================================================1982## Reduce ExpoPS2DPol1983def _rexpps2d_reduce_ ( pdf ):1984    """Reduce ExpoPS2DPol"""1985    return root_store_factory , ( type ( pdf )    ,1986                                  pdf.name        ,1987                                  pdf.title       ,1988                                  pdf.x        () ,                            1989                                  pdf.y        () ,1990                                  pdf.tau      () ,                            1991                                  pdf.psY      () ,                            1992                                  pdf.nX       () ,                            1993                                  pdf.nY       () ,                            1994                                  pdf.phis     () )1995Ostap.Models.ExpoPS2DPol.__reduce__ = _rexpps2d_reduce_ 1996# =============================================================================1997## reduce Spline2D1998def _rspl2d_reduce_ ( pdf ):1999    """Reduce Spline2D"""2000    return root_store_factory , ( type ( pdf )    ,2001                                  pdf.name        ,2002                                  pdf.title       ,2003                                  pdf.x        () ,                            2004                                  pdf.y        () ,                            2005                                  pdf.spline   () ,                            2006                                  pdf.phis     () )2007Ostap.Models.Spline2D .__reduce__ = _rspl2d_reduce_ 2008# =============================================================================2009## reduce Spline2DSym2010def _rspl2ds_reduce_ ( pdf ):2011    """Reduce Spline2DSym"""2012    return root_store_factory , ( type ( pdf )    ,2013                                  pdf.name        ,2014                                  pdf.title       ,2015                                  pdf.x        () ,                            2016                                  pdf.y        () ,                            2017                                  pdf.spline   () ,                            2018                                  pdf.phis     () )2019Ostap.Models.Spline2DSym.__reduce__ = _rspl2ds_reduce_ 2020# =============================================================================2021## reduce Gauss2D2022def _rgauss2d_reduce_ ( pdf ):2023    """Reduce Gauss2D"""2024    return root_store_factory , ( type ( pdf )    ,2025                                  pdf.name        ,2026                                  pdf.title       ,2027                                  pdf.x        () ,                            2028                                  pdf.y        () ,                            2029                                  pdf.muX      () ,                            2030                                  pdf.muY      () ,                            2031                                  pdf.sigmaX   () ,                            2032                                  pdf.sigmaY   () ,                            2033                                  pdf.theta    () )2034Ostap.Models.Gauss2D.__reduce__ = _rgauss2d_reduce_ 2035# =============================================================================2036## reduce Poly3DPositive2037def _rpol3d_reduce_ ( pdf ):2038    """Reduce Poly3DPositive"""2039    return root_store_factory , ( type ( pdf )    ,2040                                  pdf.name        ,2041                                  pdf.title       ,2042                                  pdf.x        () ,                            2043                                  pdf.y        () ,                            2044                                  pdf.z        () ,                            2045                                  pdf.nX       () ,                            2046                                  pdf.nX       () ,                            2047                                  pdf.nY       () ,                            2048                                  pdf.nZ       () ,                            2049                                  pdf.phis     () )2050Ostap.Models.Poly3DPositive.__reduce__ = _rpol3d_reduce_ 2051# =============================================================================2052## reduce Poly3DSymPositive2053def _rpol3ds_reduce_ ( pdf ):2054    """Reduce Poly3DSymPosiitive"""2055    return root_store_factory , ( type ( pdf )    ,2056                                  pdf.name        ,2057                                  pdf.title       ,2058                                  pdf.x        () ,                            2059                                  pdf.y        () ,                            2060                                  pdf.z        () ,                            2061                                  pdf.nX       () ,                            2062                                  pdf.phis     () )2063Ostap.Models.Poly3DSymPositive.__reduce__ = _rpol3ds_reduce_ 2064# =============================================================================2065## reduce Poly3DMixPositive2066def _rpol3dm_reduce_ ( pdf ):2067    """Reduce Poly3DMixPosiitive"""2068    return root_store_factory , ( type ( pdf )    ,2069                                  pdf.name        ,2070                                  pdf.title       ,2071                                  pdf.x        () ,                            2072                                  pdf.y        () ,                            2073                                  pdf.z        () ,                            2074                                  pdf.nX       () ,                            2075                                  pdf.nZ       () ,                            2076                                  pdf.phis     () )2077Ostap.Models.Poly3DMixPositive.__reduce__ = _rpol3dm_reduce_ 2078# =============================================================================2079## reduce Gauss3D2080def _rgauss3d_reduce_ ( pdf ):2081    """Reduce Gauss3D"""2082    return root_store_factory , ( type ( pdf )    ,2083                                  pdf.name        ,2084                                  pdf.title       ,2085                                  pdf.x        () ,                            2086                                  pdf.y        () ,                            2087                                  pdf.z        () ,                            2088                                  pdf.muX      () ,                            2089                                  pdf.muY      () ,                            2090                                  pdf.muZ      () ,                            2091                                  pdf.sigmaX   () ,                            2092                                  pdf.sigmaY   () ,                            2093                                  pdf.sigmaZ   () ,                            2094                                  pdf.phi      () ,2095                                  pdf.theta    () ,2096                                  pdf.psi      () )2097Ostap.Models.Gauss3D.__reduce__ = _rgauss3d_reduce_ 2098# =============================================================================2099## reduce Ostap::Functions::FuncRooTH1 2100def _rfth1_reduce_ ( fun ):2101    """Reduce Ostap.Functions.FuncTH1"""2102    return root_factory , ( type ( fun ) ,2103                            fun.histo () ,2104                            fun.x     () )2105# =============================================================================2106## reduce Ostap::Functions::FuncRooTH3 2107def _rfth2_reduce_ ( fun ):2108    """Reduce Ostap.Functions.FuncRooTH2"""2109    return root_factory , ( type ( fun ) ,2110                            fun.histo () ,2111                            fun.x     () , 2112                            fun.y     () )2113# =============================================================================2114## reduce Ostap::Functions::FuncRooTH32115def _rfth3_reduce_ ( fun ):2116    """Reduce Ostap.Functions.FuncRooTH3"""2117    return root_factory , ( type ( fun ) ,2118                            fun.histo () ,2119                            fun.x     () ,2120                            fun.y     () ,2121                            fun.z     () )2122# =============================================================================2123## reduce Ostap::Functions::FuncRooFormula2124def _rfff_reduce_ ( fun ):2125    """Reduce Ostap.Functions.FuncRooFormula"""2126    return root_factory , ( type ( fun ) , fun.expression() )2127Ostap.Functions.FuncRooTH1     . __reduce__ = _rfth1_reduce_2128Ostap.Functions.FuncRooTH2     . __reduce__ = _rfth2_reduce_2129Ostap.Functions.FuncRooTH3     . __reduce__ = _rfth3_reduce_2130Ostap.Functions.FuncRooFormula . __reduce__ =  _rfff_reduce_2131# =============================================================================2132_decorated_classes_ = (2133    ## ROOT/RooFit classes 2134    ROOT.RooBinning                    , 2135    ROOT.RooUniformBinning             , 2136    ROOT.RooRangeBinning               , 2137    ROOT.RooArgSet                     , 2138    ROOT.RooArgList                    , 2139    ROOT.RooGaussian                   , 2140    ROOT.RooMultiVarGaussian           , 2141    ROOT.RooAddPdf                     , 2142    ROOT.RooProdPdf                    , 2143    ROOT.RooFFTConvPdf                 , 2144    ROOT.RooSimultaneous               , 2145    ROOT.RooEfficiency                 , 2146    ROOT.RooPolyVar                    , 2147    ROOT.RooPolynomial                 , 2148    ROOT.RooFitResult                  ,2149    ROOT.RooPlot                       ,2150    ROOT.RooCurve                      ,2151    ROOT.RooEllipse                    ,2152    ROOT.RooHist                       ,2153    ## Ostap classes 2154    Ostap.MoreRooFit.TwoVars           , 2155    Ostap.MoreRooFit.Addition          , 2156    Ostap.MoreRooFit.Addition2         , 2157    Ostap.MoreRooFit.Subtraction       , 2158    Ostap.MoreRooFit.Product           , 2159    Ostap.MoreRooFit.ProductPdf        , 2160    Ostap.MoreRooFit.Id                , 2161    Ostap.MoreRooFit.AddDeps           , 2162    Ostap.MoreRooFit.Combination       , 2163    Ostap.MoreRooFit.Asymmetry         , 2164    Ostap.MoreRooFit.Constant          , 2165    Ostap.MoreRooFit.Bernstein         , 2166    Ostap.MoreRooFit.Monotonic         , 2167    Ostap.MoreRooFit.Convex            , 2168    Ostap.MoreRooFit.ConvexOnly        , 2169    Ostap.MoreRooFit.BSpline           ,2170    ##2171    Ostap.Models.Uniform               ,2172    ## BW & friends 2173    Ostap.Models.BreitWigner           , 2174    Ostap.Models.BreitWignerMC         , 2175    Ostap.Models.BWI                   , 2176    Ostap.Models.Flatte                ,2177    Ostap.Models.LASS                  ,2178    Ostap.Models.BWPS                  ,2179    Ostap.Models.BW3L                  ,2180    ## others 2181    Ostap.Models.Uniform               ,2182    Ostap.Models.Voigt                 , 2183    Ostap.Models.PseudoVoigt           , 2184    Ostap.Models.CrystalBall           , 2185    Ostap.Models.CrystalBallRS         , 2186    Ostap.Models.CrystalBallDS         , 2187    Ostap.Models.Needham               ,2188    Ostap.Models.Apollonios            , 2189    Ostap.Models.Apollonios2           , 2190    Ostap.Models.BifurcatedGauss       , 2191    Ostap.Models.GenGaussV1            , 2192    Ostap.Models.GenGaussV2            , 2193    Ostap.Models.SkewGauss             , 2194    Ostap.Models.ExGauss               , 2195    Ostap.Models.NormalLaplace         , 2196    Ostap.Models.Novosibirsk           , 2197    Ostap.Models.Bukin                 , 2198    Ostap.Models.StudentT              , 2199    Ostap.Models.BifurcatedStudentT    , 2200    Ostap.Models.PearsonIV             ,2201    Ostap.Models.GramCharlierA         , 2202    Ostap.Models.PhaseSpace2           , 2203    Ostap.Models.PhaseSpaceLeft        , 2204    Ostap.Models.PhaseSpaceRight       , 2205    Ostap.Models.PhaseSpaceNL          , 2206    Ostap.Models.PhaseSpacePol         , 2207    Ostap.Models.PhaseSpaceLeftExpoPol , 2208    ##2209    Ostap.Models.PolyPositive          , 2210    Ostap.Models.PolyPositiveEven      , 2211    Ostap.Models.PolyMonotonic         , 2212    Ostap.Models.PolyConvex            , 2213    Ostap.Models.PolyConvexOnly        , 2214    Ostap.Models.ExpoPositive          , 2215    Ostap.Models.PolySigmoid           , 2216    Ostap.Models.TwoExpoPositive       , 2217    Ostap.Models.GammaDist             , 2218    Ostap.Models.LogGammaDist          , 2219    Ostap.Models.Log10GammaDist        , 2220    Ostap.Models.GenGammaDist          , 2221    Ostap.Models.Amoroso               , 2222    Ostap.Models.LogGamma              , 2223    Ostap.Models.BetaPrime             , 2224    Ostap.Models.Landau                , 2225    Ostap.Models.SinhAsinh             , 2226    Ostap.Models.JohnsonSU             , 2227    Ostap.Models.Atlas                 , 2228    Ostap.Models.Sech                  , 2229    Ostap.Models.Logistic              ,2230    Ostap.Models.Hat                   , 2231    Ostap.Models.Up                    , 2232    Ostap.Models.Slash                 , 2233    Ostap.Models.Argus                 , 2234    Ostap.Models.GenArgus              , 2235    Ostap.Models.Losev                 , 2236    Ostap.Models.AsymmetricLaplace     , 2237    Ostap.Models.FupN                  , 2238    Ostap.Models.Tsallis               , 2239    Ostap.Models.QGSM                  , 2240    Ostap.Models.TwoExpos              , 2241    Ostap.Models.DoubleGauss           , 2242    Ostap.Models.Gumbel                , 2243    Ostap.Models.Weibull               , 2244    Ostap.Models.QGaussian             , 2245    Ostap.Models.Hyperbolic            , 2246    Ostap.Models.GenHyperbolic         , 2247    Ostap.Models.Das                   , 2248    Ostap.Models.GenInvGauss           , 2249    Ostap.Models.PositiveSpline        , 2250    Ostap.Models.MonotonicSpline       , 2251    Ostap.Models.ConvexSpline          , 2252    Ostap.Models.ConvexOnlySpline      , 2253    Ostap.Models.HORNSdini             , 2254    Ostap.Models.HILLdini              , 2255    Ostap.Models.Histo1D               , 2256    Ostap.Models.Histo2D               , 2257    Ostap.Models.Histo3D               , 2258    Ostap.Models.CutOffGauss           , 2259    Ostap.Models.CutOffStudent         , 2260    ## 2D models 2261    Ostap.Models.Poly2DPositive        , 2262    Ostap.Models.Poly2DSymPositive     , 2263    Ostap.Models.PS2DPol               , 2264    Ostap.Models.PS2DPol2              , 2265    Ostap.Models.PS2DPol3              , 2266    Ostap.Models.PS2DPolSym            , 2267    Ostap.Models.PS2DPol2Sym           , 2268    Ostap.Models.PS2DPol3Sym           , 2269    Ostap.Models.Expo2DPol             , 2270    Ostap.Models.Expo2DPolSym          , 2271    Ostap.Models.ExpoPS2DPol           , 2272    Ostap.Models.Spline2DSym           , 2273    Ostap.Models.Gauss2D               , 2274    Ostap.Models.Tsallis2              , 2275    ## 3D models 2276    Ostap.Models.Poly3DPositive        , 2277    Ostap.Models.Poly3DSymPositive     , 2278    Ostap.Models.Poly3DMixPositive     , 2279    Ostap.Models.Gauss3D               ,2280    ##     2281    Ostap.Functions.FuncRooTH1         , 2282    Ostap.Functions.FuncRooTH2         , 2283    Ostap.Functions.FuncRooTH3         , 2284    Ostap.Functions.FuncRooFormula     ,  2285    )2286for t in _decorated_classes_ :2287    _new_methods_.append ( t.__reduce__  )2288_new_methods_ = tuple ( _new_methods_ ) 2289# =============================================================================2290if '__main__' == __name__ :2291    2292    from ostap.utils.docme import docme2293    docme ( __name__ , logger = logger )2294    2295# =============================================================================2296##                                                                      The END ...more_reduce.py
Source:more_reduce.py  
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3# =============================================================================4## @file ostap/math/reduce.py5#  Module with some useful utilities for reducing some math objects 6# =============================================================================7__version__ = "$Revision$"8__author__  = "Vanya BELYAEV Ivan.Belyaev@cern.ch"9__date__    = "2011-12-01"10__all__     = ()11# =============================================================================12from    ostap.math.base        import Ostap, doubles 13from    ostap.math.reduce      import root_factory14from    ostap.core.ostap_types import sequence_types 15import  ROOT, array 16# =============================================================================17# logging 18# =============================================================================19from   ostap.logger.logger import getLogger 20if '__main__' ==  __name__ : logger = getLogger ( 'ostap.math.more_reduce' )21else                       : logger = getLogger ( __name__                 )22# =============================================================================23# =============================================================================24## BreitWigner and friends25# =============================================================================26# =============================================================================27## Reduce Ostap::Math::FormFactors::Jackson28#  @see Ostap::Math::FormFactors::Jackson29def _omffj_reduce_ ( ff ) :30    """Reduce `Ostap.Math.FormFactors.Jackson`31    - see `Ostap.Math.FormFactors.Jackson`32    """33    return root_factory , ( type ( ff ) , ff.rho() )34Ostap.Math.FormFactors.Jackson . __reduce__ = _omffj_reduce_35# =============================================================================36## Reduce Ostap::Math::FormFactors::BlattWeisskopf37#  @see Ostap::Math::FormFactors::BlattWeiskopf38def _omffbw_reduce_ ( ff ) :39    """Reduce `Ostap.Math.FormFactors.BlattWeiskopf`40    - see `Ostap.Math.FormFactors.BlattWeiskopf`41    """42    return root_factory , ( type ( ff ) , ff.L() , ff.breakup () )43Ostap.Math.FormFactors.BlattWeisskopf . __reduce__ = _omffbw_reduce_44# =============================================================================45## Reduce Ostap::Math::FormFactors::NoFormFactor46#  @see Ostap::Math::FormFactors::NoFormFactor47def _omffnf_reduce_ ( ff ) :48    """Reduce `Ostap.Math.FormFactors.NoFormFactor`49    - see `Ostap.Math.FormFactors.NoFormFactor`50    """51    return root_factory , ( type ( ff ) , )52Ostap.Math.FormFactors.NoFormFactor. __reduce__ = _omffnf_reduce_53# =============================================================================54## Reduce Ostap::Math::ChannelCW55#  @see Ostap::Math::ChannelCW56def _omccw_reduce_ ( ch ) :57    """Reduce `Ostap.Math.ChannelCW`58    - see `Ostap.Math.ChannelCW`59    """60    return root_factory , ( type ( ch ) , ch.gamma0() , ch.m1() , ch.m2() )61Ostap.Math.ChannelCW     . __reduce__ = _omccw_reduce_62Ostap.Math.ChannelQ      . __reduce__ = _omccw_reduce_63Ostap.Math.ChannelFlatte . __reduce__ = _omccw_reduce_64# =============================================================================65## Reduce Ostap::Math::ChannelFlatteBugg66#  @see Ostap::Math::ChannelFlatteBugg67def _omcfb_reduce_ ( ch ) :68    """Reduce `Ostap.Math.ChannelFlatteBugg`69    - see `Ostap.Math.ChannelFlatteBugg`70    """71    return root_factory , ( type ( ch )    ,72                            ch.gamma0   () ,73                            ch.mcharged () ,74                            ch.mneutral () ,                            75                            ch.alpha    () ,76                            ch.fc       () , 77                            ch.fn       () )78Ostap.Math.ChannelFlatteBugg . __reduce__ = _omcfb_reduce_79# =============================================================================80## Reduce Ostap::Math::Channel81#  @see Ostap::Math::Channel82def _omc_reduce_ ( ch ) :83    """Reduce `Ostap.Math.Channel`84    - see `Ostap.Math.Channel`85    """86    return root_factory , ( type ( ch ) , ch.gamma0() , ch.m1() , ch.m2() , ch.L() , ch.formfactor () )87Ostap.Math.Channel. __reduce__ = _omc_reduce_88# =============================================================================89## Reduce Ostap::Math::Channel090#  @see Ostap::Math::Channel091def _omc0_reduce_ ( ch ) :92    """Reduce `Ostap.Math.Channel0`93    - see `Ostap.Math.Channel0`94    """95    return root_factory , ( type ( ch ) , ch.gamma0() , ch.m1() , ch.m2() , ch.L() , ch.formfactor () , ch.qs () )96Ostap.Math.Channel0. __reduce__ = _omc0_reduce_97# =============================================================================98## reduce Ostap::Math::Channel23L99#  @see Ostap::Math::Channel23L100def _omc23l_reduce_ ( ch ) : 101    """Reduce `Ostap.Math.Channel23L`102    - see `Ostap.Math.Channel23L`103    """104    return root_factory , ( type ( ch ) , ch.channel() , ch.ps23L () ) 105   106Ostap.Math.Channel23L. __reduce__ = _omc23l_reduce_107# =============================================================================108## reduce Ostap::Math::ChanneNR3109#  @see Ostap::Math::ChannelNR3110def _omcnr3_reduce_ ( ch ) : 111    """Reduce `Ostap.Math.ChannelNR3`112    - see `Ostap.Math.ChannelNR3`113    """114    return root_factory , ( type ( ch ) , ch.m1() , ch.m2() , ch.m3() )115   116Ostap.Math.ChannelNR3. __reduce__ = _omcnr3_reduce_117# =============================================================================118## reduce Ostap::Math::ChanneGS119#  @see Ostap::Math::ChannelGS120def _omcgs_reduce_ ( ch ) : 121    """Reduce `Ostap.Math.ChannelGS`122    - see `Ostap.Math.ChannelGS`123    """124    return root_factory , ( type ( ch ) , ch.gamma0() , ch.mpi() )125   126Ostap.Math.ChannelGS. __reduce__ = _omcgs_reduce_127# =============================================================================128## Reduce Ostap::Math::BW129#  @see Ostap::Math::BW130def _ombw_reduce_ ( bw ) :131    """Reduce `Ostap.Math.BW`132    - see `Ostap.Math.BW`133    """134    return root_factory , ( type ( bw ) , bw.m0() , bw.channel() )135Ostap.Math.BW         . __reduce__ = _ombw_reduce_136Ostap.Math.BreitWigner. __reduce__ = _ombw_reduce_137# =============================================================================138## Reduce Ostap::Math::Rho0139#  @see Ostap::Math::Rho0140def _omr0_reduce_ ( bw ) :141    """Reduce `Ostap.Math.Rho0`142    - see `Ostap.Math.Rho0`143    """144    return root_factory , ( type ( bw ) , bw.m0() , bw.gamma ( 0 ) ,  bw.m1() ) 145# =============================================================================146## Reduce Ostap::Math::Kstar0147#  @see Ostap::Math::Kstar0148def _omks0_reduce_ ( bw ) :149    """Reduce `Ostap.Math.Kstar0`150    - see `Ostap.Math.Kstar0`151    """152    return root_factory , ( type ( bw ) , bw.m0() , bw.gamma ( 0 ) ,  bw.m1() , bw.m2() ) 153Ostap.Math.Rho0   . __reduce__ = _omr0_reduce_154Ostap.Math.Phi0   . __reduce__ = _omr0_reduce_155Ostap.Math.Kstar0 . __reduce__ = _omks0_reduce_156## ============================================================================157## factory for Ostap::Math::BreintWignerMC158#  @see Ostap::Math::BreintWignerMC159def _ombwmc_factory ( klass , m0 , channel , *channels )  :160    """Factory for Ostap::Math::BreintWignerMC161    - see Ostap::Math::BreintWignerMC162    """163    bwmc = klass ( m0 , channel )164    for c in channels : bwmc.addChannel ( c )165    return bwmc 166# =============================================================================167## Reduce Ostap::Math::BreitWignerMC 168#  @see Ostap::Math::BreintWignerMC 169def _ombwmc_reduce_ ( bw ) :170    """Reduce `Ostap.Math.BreitWignerMC`171    - see `Ostap.Math.BreitWignerMC`172    """173    content =  type ( bw ) , bw.m0()174    content += tuple ( bw.channel ( i ) for i in range ( bw.nChannels() ) )175    return _ombwmc_factory , content 176    177Ostap.Math.BreitWignerMC. __reduce__ = _ombwmc_reduce_178# =============================================================================179## Reduce Ostap::Math::Flatte180#  @see Ostap::Math::Flatte181def _omflt_reduce_ ( bw ) :182    """Reduce `Ostap.Math.Flatte`183    - see `Ostap.Math.Flatte`184    """185    return root_factory , ( type ( bw ) , bw.m0()    ,186                            bw.m0g1()   , bw.g2og1() ,187                            bw.mA1 ()   ,  bw.mA2()  , 188                            bw.mB1 ()   ,  bw.mB2()  , bw.g0 () ) 189                            190Ostap.Math.Flatte. __reduce__ = _omflt_reduce_191# =============================================================================192## Reduce Ostap::Math::FlatteBugg193#  @see Ostap::Math::FlatteBugg194def _omfltb_reduce_ ( bw ) :195    """Reduce `Ostap.Math.FlatteBugg`196    - see `Ostap.Math.FlatteBugg`197    """198    return root_factory , ( type ( bw ) ,199                            bw.m0      () ,200                            bw.g1      () ,201                            bw.g2og1   () ,202                            bw.alpha   () ,203                            bw.mpiplus () ,204                            bw.mpizero () ,205                            bw.mKplus  () ,206                            bw.mKzero  () ,207                            bw.g0      () )208Ostap.Math.FlatteBugg. __reduce__ = _omfltb_reduce_209# =============================================================================210## Reduce Ostap::Math::LASS211#  @see Ostap::Math::LASS212def _omlass_reduce_ ( bw ) :213    """Reduce `Ostap.Math.LASS`214    - see `Ostap.Math.LASS`215    """216    return root_factory , ( type ( bw ) , bw.m0() , bw.gamma() ,217                            bw.m1() , bw.m2() , bw.m3() ,218                            bw.a () , bw.b () , bw.e () ) 219                            220Ostap.Math.LASS. __reduce__ = _omlass_reduce_221# =============================================================================222## Reduce Ostap::Math::BWPS223#  @see Ostap::Math::BWPS224def _ombwps_reduce_ ( bw ) :225    """Reduce `Ostap.Math.BWPS`226    - see `Ostap.Math.BWPS`227    """228    return root_factory , ( type ( bw ) ,229                            bw.breit_wigner() ,230                            bw.phase_space () ,231                            bw.use_rho     () ,232                            bw.use_N2      () )233                            234Ostap.Math.BWPS. __reduce__ = _ombwps_reduce_235# =============================================================================236## Reduce Ostap::Math::BW3L237#  @see Ostap::Math::BW3L238def _ombw3l_reduce_ ( bw ) :239    """Reduce `Ostap.Math.BW3L`240    - see `Ostap.Math.BW3L`241    """242    return root_factory , ( type ( bw ) ,243                            bw.breit_wigner() ,244                            bw.M() , bw.m1() , bw.m2() , bw.m3() , bw.L() )245                            246Ostap.Math.BW3L. __reduce__ = _ombw3l_reduce_247# =============================================================================248## Reduce Ostap::Math::A2249#  @see Ostap::Math::A2250def _oma2_reduce_ ( bw ) :251    """Reduce `Ostap.Math.A2`252    - see `Ostap.Math.A2`253    """254    return root_factory , ( type ( bw ) , bw.bw() , bw.scale() )255                            256Ostap.Math.A2. __reduce__ = _oma2_reduce_257# =============================================================================258## Other peaks259# =============================================================================260# =============================================================================261## Reduce Ostap::Math::BifurcatedGauss 262#  @see Ostap::Math::BifurcatedGauss263def _ombfg_reduce_ ( peak ) :264    """Reduce `Ostap.Math.BifurcatedGauss`265    - see `Ostap.Math.BifurcatedGauss`266    """267    return root_factory , ( type ( peak ) , peak.m0 () , peak.sigmaL() , peak.sigmaR() )268Ostap.Math.BifurcatedGauss. __reduce__ = _ombfg_reduce_269# =============================================================================270## Reduce Ostap::Math::DoubleGauss 271#  @see Ostap::Math::DoubleGauss272def _om2g_reduce_ ( peak ) :273    """Reduce `Ostap.Math.DoubleGauss`274    - see `Ostap.Math.GoubleGauss`275    """276    return root_factory , ( type ( peak ) ,277                            peak.m0       () , peak.sigma() ,278                            peak.fraction () , peak.scale() ) 279Ostap.Math.DoubleGauss. __reduce__ = _om2g_reduce_280# =============================================================================281## Reduce Ostap::Math::Gauss 282#  @see Ostap::Math::Gauss283def _omg_reduce_ ( peak ) :284    """Reduce `Ostap.Math.Gauss`285    - see `Ostap.Math.Gauss`286    """287    return root_factory , ( type ( peak ) , peak.m0 () , peak.sigma() )288Ostap.Math.Gauss. __reduce__ = _omg_reduce_289# =============================================================================290## Reduce Ostap::Math::GenGaussV1291#  @see Ostap::Math::GenGaussV1292def _omggv1_reduce_ ( peak ) :293    """Reduce `Ostap.Math.GenGaussV1`294    - see `Ostap.Math.GenGaussV1`295    """296    return root_factory , ( type ( peak ) , peak.mu() , peak.alpha() , peak.beta() )297Ostap.Math.GenGaussV1. __reduce__ = _omggv1_reduce_298# =============================================================================299## Reduce Ostap::Math::GenGaussV2300#  @see Ostap::Math::GenGaussV2301def _omggv2_reduce_ ( peak ) :302    """Reduce `Ostap.Math.GenGaussV2`303    - see `Ostap.Math.GenGaussV2`304    """305    return root_factory , ( type ( peak ) , peak.xi() , peak.alpha() , peak.kappa() )306Ostap.Math.GenGaussV2. __reduce__ = _omggv2_reduce_307# =============================================================================308## Reduce Ostap::Math::SkewGauss309#  @see Ostap::Math::SkewGauss310def _omskg_reduce_ ( peak ) :311    """Reduce `Ostap.Math.SkewGauss`312    - see `Ostap.Math.SkewGauss`313    """314    return root_factory , ( type ( peak ) , peak.xi() , peak.omega() , peak.alpha() )315Ostap.Math.SkewGauss. __reduce__ = _omskg_reduce_316# =============================================================================317## Reduce Ostap::Math::ExGauss318#  @see Ostap::Math::ExGauss319def _omexg_reduce_ ( peak ) :320    """Reduce `Ostap.Math.ExGauss`321    - see `Ostap.Math.ExGauss`322    """323    return root_factory , ( type ( peak ) , peak.mu() , peak.varsigma() , peak.k () )324Ostap.Math.ExGauss. __reduce__ = _omexg_reduce_325# =============================================================================326## Reduce Ostap::Math::NormalLaplace327#  @see Ostap::Math::NormalLaplace328def _omnl_reduce_ ( peak ) :329    """Reduce `Ostap.Math.NormalLaplace`330    - see `Ostap.Math.NormalLaplace`331    """332    return root_factory , ( type ( peak ) , peak.mu() , peak.varsigma() , peak.kL() , peak.kR () )333Ostap.Math.NormalLaplace. __reduce__ = _omnl_reduce_334# =============================================================================335## Reduce Ostap::Math::Bukin336#  @see Ostap::Math::Nukin337def _ombu_reduce_ ( peak ) :338    """Reduce `Ostap.Math.Bukin`339    - see `Ostap.Math.Bukin`340    """341    return root_factory , ( type ( peak ) , peak.m0() , peak.sigma() ,342                            peak.xi() , peak.rho_L() , peak.rho_R () )343Ostap.Math.Bukin. __reduce__ = _ombu_reduce_344# =============================================================================345## Reduce Ostap::Math::Novosibirsk346#  @see Ostap::Math::BNovosibirsk347def _omnovo_reduce_ ( peak ) :348    """Reduce `Ostap.Math.Novosibirsk`349    - see `Ostap.Math.Novosibirsk`350    """351    return root_factory , ( type ( peak ) , peak.m0() , peak.sigma() , peak.tau() ) 352Ostap.Math.Novosibirsk. __reduce__ = _omnovo_reduce_353# =============================================================================354## Reduce Ostap::Math::CrystalBall355#  @see Ostap::Math::CristalBall356def _omcb_reduce_ ( peak ) :357    """Reduce `Ostap.Math.CrystalBall`358    - see `Ostap.Math.CrystalBall`359    """360    return root_factory , ( type ( peak ) , peak.m0() , peak.sigma() , peak.alpha() , peak.n() )361Ostap.Math.CrystalBall         . __reduce__ = _omcb_reduce_362Ostap.Math.CrystalBallRightSide. __reduce__ = _omcb_reduce_363# =============================================================================364## Reduce Ostap::Math::Needham365#  @see Ostap::Math::Needham366def _ommatt_reduce_ ( peak ) :367    """Reduce `Ostap.Math.Needham`368    - see `Ostap.Math.Needham`369    """370    return root_factory , ( type ( peak ) , peak.m0 () , peak.sigma() ,371                            peka.a0 ()    , peak.a1 () , peak.a2   () ) 372Ostap.Math.Needham  . __reduce__ = _ommatt_reduce_373# =============================================================================374## Reduce Ostap::Math::CrystalBallDoubleSided375#  @see Ostap::Math::CristalBallDoubleSided 376def _omcb2_reduce_ ( peak ) :377    """Reduce `Ostap.Math.CrystalBallDoubleSided`378    - see `Ostap.Math.CrystalBallDoubleSided`379    """380    return root_factory , ( type ( peak ) , peak.m0() , peak.sigma() ,381                            peak.alpha_L() , peak.n_L() ,382                            peak.alpha_R() , peak.n_R() )383                            384Ostap.Math.CrystalBallDoubleSided. __reduce__ = _omcb2_reduce_385# =============================================================================386## Reduce Ostap::Math::Apollonios387#  @see Ostap::Math::Apollonios388def _omapo_reduce_ ( peak ) :389    """Reduce `Ostap.Math.Apollonios`390    - see `Ostap.Math.Apollonios`391    """392    return root_factory , ( type ( peak ) , peak.m0() , peak.sigma() ,393                            peak.alpha () , peak.n () , peak.b    () )394                      395Ostap.Math.Apollonios. __reduce__ = _omapo_reduce_396# =============================================================================397## Reduce Ostap::Math::Apollonios2398#  @see Ostap::Math::Apollonios2399def _omapo2_reduce_ ( peak ) :400    """Reduce `Ostap.Math.Apollonios2`401    - see `Ostap.Math.Apollonios2`402    """403    return root_factory , ( type ( peak ) , peak.m0()  ,404                            peak.sigmaL() , peak.sigmaR() , peak.beta () )405                      406Ostap.Math.Apollonios2. __reduce__ = _omapo2_reduce_407# =============================================================================408## Reduce Ostap::Math::StudentT409#  @see Ostap::Math::StudentT410def _omstt_reduce_ ( peak ) :411    """Reduce `Ostap.Math.StudentT`412    - see `Ostap.Math.StudentT`413    """414    return root_factory , ( type ( peak ) , peak.m0() , peak.sigma () , peak.n () )415                      416Ostap.Math.StudentT. __reduce__ = _omstt_reduce_417# =============================================================================418## Reduce Ostap::Math::BifurcatedStudentT419#  @see Ostap::Math::BifurcatedStudentT420def _ombfstt_reduce_ ( peak ) :421    """Reduce `Ostap.Math.BifurcatedStudentT`422    - see `Ostap.Math.BifurcatedStudentT`423    """424    return root_factory , ( type ( peak )  , peak.m0    () ,425                            peak.sigmaL () ,peak.sigmaR () ,426                            peak.nL     () , peak.nR    () )427Ostap.Math.BifurcatedStudentT. __reduce__ = _ombfstt_reduce_428# =============================================================================429## Reduce Ostap::Math::PearsonIV430#  @see Ostap::Math::PearsonIV431def _omp4_reduce_ ( peak ) :432    """Reduce `Ostap.Math.PearsonIV`433    - see `Ostap.Math.PearsonIV`434    """435    return root_factory , ( type ( peak )    , peak.mu () ,436                            peak.varsigma () , peak.n  () , peak.kappa () )437Ostap.Math.PearsonIV. __reduce__ = _omp4_reduce_438# =============================================================================439## Reduce Ostap::Math::SinhAsinh440#  @see Ostap::Math::SinhAsinh441def _omshash_reduce_ ( peak ) :442    """Reduce `Ostap.Math.SinhAsinh`443    - see `Ostap.Math.SinhAsinh`444    """445    return root_factory , ( type ( peak )    , peak.location () ,446                            peak.scale () , peak.epsilon () , peak.delta () )447Ostap.Math.SinhAsinh. __reduce__ = _omshash_reduce_448# =============================================================================449## Reduce Ostap::Math::JohnsonSU450#  @see Ostap::Math::JohnsonSU451def _omjsu_reduce_ ( peak ) :452    """Reduce `Ostap.Math.JohnsonSU`453    - see `Ostap.Math.JohnsonSU`454    """455    return root_factory , ( type ( peak )    , peak.xi  () ,456                            peak.lambd () , peak.delta  () , peak.gamma () )457Ostap.Math.JohnsonSU. __reduce__ = _omjsu_reduce_458# =============================================================================459## Reduce Ostap::Math::Atlas460#  @see Ostap::Math::Atlas461def _omatlas_reduce_ ( peak ) :462    """Reduce `Ostap.Math.Atlas`463    - see `Ostap.Math.Atlas`464    """465    return root_factory , ( type ( peak )    , peak.mean () , peak.sigma () )466Ostap.Math.Atlas   . __reduce__ = _omatlas_reduce_467Ostap.Math.Sech    . __reduce__ = _omatlas_reduce_468Ostap.Math.Logistic. __reduce__ = _omatlas_reduce_469# =============================================================================470## Reduce Ostap::Math::Losev471#  @see Ostap::Math::Losev472def _omlosev_reduce_ ( peak ) :473    """Reduce `Ostap.Math.Losev`474    - see `Ostap.Math.Losev`475    """476    return root_factory , ( type ( peak ) , peak.mu () , peak.alpha () , peka.beta () )477Ostap.Math.Losev   . __reduce__ = _omlosev_reduce_478# =============================================================================479## Reduce Ostap::Math::Slash480#  @see Ostap::Math::Slash481def _omslash_reduce_ ( peak ) :482    """Reduce `Ostap.Math.Slash`483    - see `Ostap.Math.Slash`484    """485    return root_factory , ( type ( peak )    , peak.mean () , peak.scale () )486Ostap.Math.Slash  . __reduce__ = _omslash_reduce_487# =============================================================================488## Reduce Ostap::Math::AsymmetricLaplace489#  @see Ostap::Math::AsymmetricLaplace490def _omal_reduce_ ( peak ) :491    """Reduce `Ostap.Math.AsymmetricLaplace`492    - see `Ostap.Math.AsymmetricLaplace`493    """494    return root_factory , ( type ( peak ) , peak.mu () , peak.lambdaL ()  , peak.lambdaR() )495Ostap.Math.AsymmetricLaplace. __reduce__ = _omal_reduce_496# =============================================================================497## Reduce Ostap::Math::RaisngCosine 498#  @see Ostap::Math::RaisingCosine499def _omrcos_reduce_ ( peak ) :500    """Reduce `Ostap.Math.RaisingCosine`501    - see `Ostap.Math.RaisingCosine`502    """503    return root_factory , ( type ( peak ) , peak.mu () , peak.s () )504Ostap.Math.RaisingCosine. __reduce__ = _omrcos_reduce_505# =============================================================================506## Reduce Ostap::Math::QGaussian507#  @see Ostap::Math::QGaussian508def _omqg_reduce_ ( peak ) :509    """Reduce `Ostap.Math.QGaussian`510    - see `Ostap.Math.QGaussian`511    """512    return root_factory , ( type ( peak ) , peak.mean () , peak.q () , peak.scale () )513Ostap.Math.QGaussian. __reduce__ = _omqg_reduce_514# =============================================================================515## Reduce Ostap::Math::Hyperbolic516#  @see Ostap::Math::Hyperbolic517def _omhyp_reduce_ ( peak ) :518    """Reduce `Ostap.Math.Hyperbolic`519    - see `Ostap.Math.Hyperbolic`520    """521    return root_factory , ( type ( peak ) , peak.mu   () ,522                            peak.sigma()  , peak.zeta ()  , peak.kappa () )523Ostap.Math.Hyperbolic. __reduce__ = _omhyp_reduce_524# =============================================================================525## Reduce Ostap::Math::GenHyperbolic526#  @see Ostap::Math::GenHyperbolic527def _omghyp_reduce_ ( peak ) :528    """Reduce `Ostap.Math.GenHyperbolic`529    - see `Ostap.Math.GenHyperbolic`530    """531    return root_factory , ( type ( peak ) , peak.mu   () ,532                            peak.sigma()  , peak.zeta ()  , peak.kappa () , peka.lambd () )533Ostap.Math.GenHyperbolic. __reduce__ = _omghyp_reduce_534# =============================================================================535## Reduce Ostap::Math::Das536#  @see Ostap::Math::Das537def _omdas_reduce_ ( peak ) :538    """Reduce `Ostap.Math.Das`539    - see `Ostap.Math.Das`540    """541    return root_factory , ( type ( peak ) , peak.mu () ,542                            peak.sigma()  , peak.kL ()  , peak.kR () )543Ostap.Math.Das. __reduce__ = _omdas_reduce_544# =============================================================================545## Reduce Ostap::Math::Hat546#  @see Ostap::Math::Hat547def _omhat_reduce_ ( peak ) :548    """Reduce `Ostap.Math.Hat`549    - see `Ostap.Math.Hat`550    """551    return root_factory , ( type ( peak ) , peak.mu   () , peak.varsigma() )552Ostap.Math.Hat. __reduce__ = _omhat_reduce_553Ostap.Math.Up. __reduce__ = _omhat_reduce_554# =============================================================================555## Reduce Ostap::Math::FupN556#  @see Ostap::Math::FupN557def _omfup_reduce_ ( peak ) :558    """Reduce `Ostap.Math.FupN`559    - see `Ostap.Math.FupN`560    """561    return root_factory , ( type ( peak ) , peak.N() , peak.mu   () , peak.varsigma() )562Ostap.Math.FupN. __reduce__ = _omfup_reduce_563# =============================================================================564## Mdoels 565# =============================================================================566# =============================================================================567## Reduce Ostap::Math::Gumbel568#  @see Ostap::Math::Gumbel569def _omgum_reduce_ ( s ) :570    """Reduce `Ostap.Math.Gumbel`571    - see `Ostap.Math.Gumbel`572    """573    return root_factory , ( type ( s ) , s.mu () , s.beta () ) 574Ostap.Math.Gumbel  . __reduce__ = _omgum_reduce_575# =============================================================================576## Reduce Ostap::Math::GramCahrlierA577#  @see Ostap::Math::GramCharlierA578def _omgca_reduce_ ( s ) :579    """Reduce `Ostap.Math.GramCharlierA`580    - see `Ostap.Math.GramCharlierA`581    """582    return root_factory , ( type ( s ) , s.m0 () , s.sigma() , s.kappa3() , s.kappa4() ) 583Ostap.Math.GramCharlierA. __reduce__ = _omgca_reduce_584# =============================================================================585## Reduce Ostap::Math::PhaseSpacePol586#  @see Ostap::Math::PhaseSpacePol587def _ompspol_reduce_ ( s ) :588    """Reduce `Ostap.Math.PhaseSpacePol`589    - see `Ostap.Math.PhaseSpacePol`590    """591    return root_factory , ( type ( s ) , s.phasespace() , s.positive() )  592Ostap.Math.PhaseSpacePol. __reduce__ = _ompspol_reduce_593# =============================================================================594## Reduce Ostap::Math::PhaseSpaceLeftExpoPol595#  @see Ostap::Math::PhaseSpacePol596def _ompslexp_reduce_ ( s ) :597    """Reduce `Ostap.Math.PhaseSpaceLeftExpoPol`598    - see `Ostap.Math.PhaseSpaceLeftExpoPol`599    """600    return root_factory , ( type ( s ) , s.phasespace() , s.positive() . s.tau () )  601Ostap.Math.PhaseSpaceLeftExpoPol. __reduce__ = _ompslexp_reduce_602# =============================================================================603## Reduce Ostap::Math::GammaDist604#  @see Ostap::Math::GammaDist605def _omgdis_reduce_ ( s ) :606    """Reduce `Ostap.Math.GammaDist`607    - see `Ostap.Math.GammaDist`608    """609    return root_factory , ( type ( s ) , s.k() , s.theta() )  610Ostap.Math.GammaDist     . __reduce__ = _omgdis_reduce_611Ostap.Math.LogGammaDist  . __reduce__ = _omgdis_reduce_612Ostap.Math.Log10GammaDist. __reduce__ = _omgdis_reduce_613# =============================================================================614## Reduce Ostap::Math::GenGammaDist615#  @see Ostap::Math::GenGammaDist616def _omggdis_reduce_ ( s ) :617    """Reduce `Ostap.Math.GenGammaDist`618    - see `Ostap.Math.GenGammaDist`619    """620    return root_factory , ( type ( s ) , s.k() , s.theta() , s.p() , s.low() )  621Ostap.Math.GenGammaDist    . __reduce__ = _omggdis_reduce_622# =============================================================================623## Reduce Ostap::Math::LogGamma624#  @see Ostap::Math::LogGamma625def _omlgam_reduce_ ( s ) :626    """Reduce `Ostap.Math.LogGamma`627    - see `Ostap.Math.LogGamma`628    """629    return root_factory , ( type ( s ) , s.nu () , s.lambd () , s.alpha () )  630Ostap.Math.LogGamma . __reduce__ = _omlgam_reduce_631# =============================================================================632## Reduce Ostap::Math::BetaPrime633#  @see Ostap::Math::BetaPrime634def _ombprim_reduce_ ( s ) :635    """Reduce `Ostap.Math.BetaPrime`636    - see `Ostap.Math.BetaPrime`637    """638    return root_factory , ( type ( s ) , s.alpha () , s.beta() , s.scale() , s.shift () )639Ostap.Math.BetaPrime. __reduce__ = _ombprim_reduce_640# =============================================================================641## Reduce Ostap::Math::Landau642#  @see Ostap::Math::Landau643def _omland_reduce_ ( s ) :644    """Reduce `Ostap.Math.Landau`645    - see `Ostap.Math.Landau`646    """647    return root_factory , ( type ( s ) , s.scale() , s.shift () )648Ostap.Math.Landau. __reduce__ = _omland_reduce_649# =============================================================================650## Reduce Ostap::Math::Weibull651#  @see Ostap::Math::Weibull652def _omwb_reduce_ ( s ) :653    """Reduce `Ostap.Math.Weibull`654    - see `Ostap.Math.Weibull`655    """656    return root_factory , ( type ( s ) , s.scale() , s.shape () , s.shift () )657Ostap.Math.Weibull. __reduce__ = _omwb_reduce_658# =============================================================================659## Reduce Ostap::Math::ExpoPosition660#  @see Ostap::Math::ExpoPositive661def _omepos_reduce_ ( s ) :662    """Reduce `Ostap.Math.ExpoPositive`663    - see `Ostap.Math.ExpoPositive`664    """665    return root_factory , ( type ( s ) , s.positive () , s.tau() )666Ostap.Math.ExpoPositive. __reduce__ = _omepos_reduce_667# =============================================================================668## Reduce Ostap::Math::Sigmoid669#  @see Ostap::Math::Sigmoid670def _omsigm_reduce_ ( s ) :671    """Reduce `Ostap.Math.Sigmoid`672    - see `Ostap.Math.Sigmoid`673    """674    return root_factory , ( type ( s ) , s.positive () , s.alpha() , s.x0() )675Ostap.Math.Sigmoid. __reduce__ = _omsigm_reduce_676# =============================================================================677## Reduce Ostap::Math::TwoExpos678#  @see Ostap::Math::TwoExpos679def _om2exp_reduce_ ( s ) :680    """Reduce `Ostap.Math.TwoExpos`681    - see `Ostap.Math.TwoExpos`682    """683    return root_factory , ( type ( s ) , s.alpha() , s.delta() , s.x0 ()  )684Ostap.Math.TwoExpos. __reduce__ = _om2exp_reduce_685# =============================================================================686## Reduce Ostap::Math::TwoExpos687#  @see Ostap::Math::TwoExpos688def _om2exp_reduce_ ( s ) :689    """Reduce `Ostap.Math.TwoExpos`690    - see `Ostap.Math.TwoExpos`691    """692    return root_factory , ( type ( s ) , s.alpha() , s.delta() , s.x0 ()  )693Ostap.Math.TwoExpos. __reduce__ = _om2exp_reduce_694# =============================================================================695## Reduce Ostap::Math::TwoExpoPositive696#  @see Ostap::Math::TwoExpoPositive697def _om2exppos_reduce_ ( s ) :698    """Reduce `Ostap.Math.TwoExpoPositive`699    - see `Ostap.Math.TwoExpoPositive`700    """701    return root_factory , ( type ( s ) , s.twoexpos() , s.positive() )702Ostap.Math.TwoExpoPositive. __reduce__ = _om2exppos_reduce_703# =============================================================================704## Reduce Ostap::Math::Rice705#  @see Ostap::Math::Rice706def _omrice_reduce_ ( s ) :707    """Reduce `Ostap.Math.Rice`708    - see `Ostap.Math.Rice`709    """710    return root_factory , ( type ( s ) , s.nu() , s.varsigma() , s.shift () )711Ostap.Math.Rice. __reduce__ = _omrice_reduce_712# =============================================================================713## Reduce Ostap::Math::GenInvGauss714#  @see Ostap::Math::GenInvGauss715def _omgig_reduce_ ( s ) :716    """Reduce `Ostap.Math.GenInvGauss`717    - see `Ostap.Math.GenInvGauss`718    """719    return root_factory , ( type ( s ) , s.theta() , s.eta() , s.p() , s.shift()  )720Ostap.Math.GenInvGauss. __reduce__ = _omgig_reduce_721# =============================================================================722## Reduce Ostap::Math::Argus723#  @see Ostap::Math::Argus724def _omargus_reduce_ ( s ) :725    """Reduce `Ostap.Math.Argus`726    - see `Ostap.Math.Argus`727    """728    return root_factory , ( type ( s ) , s.mu() , s.c() , s.chi ()  )729Ostap.Math.Argus. __reduce__ = _omargus_reduce_730# =============================================================================731## Reduce Ostap::Math::GenArgus732#  @see Ostap::Math::GenArgus733def _omgargus_reduce_ ( s ) :734    """Reduce `Ostap.Math.GenArgus`735    - see `Ostap.Math.GenArgus`736    """737    return root_factory , ( type ( s ) , s.mu() , s.c() , s.chi () , s.dp () )738Ostap.Math.GenArgus. __reduce__ = _omgargus_reduce_739# =============================================================================740## Reduce Ostap::Math::Tsallis741#  @see Ostap::Math::Tsalllis742def _omts_reduce_ ( s ) :743    """Reduce `Ostap.Math.Tsallis`744    - see `Ostap.Math.Tsallis`745    """746    return root_factory , ( type ( s ) , s.mass () , s.n () , s.T () )747Ostap.Math.Tsallis. __reduce__ = _omts_reduce_748# =============================================================================749## Reduce Ostap::Math::QGSM750#  @see Ostap::Math::QGSM751def _omqgsm_reduce_ ( s ) :752    """Reduce `Ostap.Math.QGSM`753    - see `Ostap.Math.QGSM`754    """755    return root_factory , ( type ( s ) , s.mass () , s.b () )756Ostap.Math.QGSM. __reduce__ = _omqgsm_reduce_757# =============================================================================758## Reduce Ostap::Math::HORNSdini759#  @see Ostap::Math::HORNSdini760def _omdini_reduce_ ( s ) :761    """Reduce `Ostap.Math.HORNSdini`762    - see `Ostap.Math.HORNSdini`763    """764    return root_factory , ( type ( s ) , s.a() , s.delta() , s.phi ()  )765Ostap.Math.HORNSdini. __reduce__ = _omdini_reduce_766Ostap.Math.HILLdini . __reduce__ = _omdini_reduce_767# =============================================================================768## Reduce Ostap::Math::CutOffGauss769#  @see Ostap::Math::CutOffGauss770def _omcgau_reduce_ ( s ) :771    """Reduce `Ostap.Math.CutOffGauss`772    - see `Ostap.Math.CutOffGauss`773    """774    return root_factory , ( type ( s ) , s.right () , s.x0 () , s.sigma()  )775Ostap.Math.CutOffGauss. __reduce__ = _omcgau_reduce_776# =============================================================================777## Reduce Ostap::Math::CutOffStudent778#  @see Ostap::Math::CutOffStudent779def _omcstt_reduce_ ( s ) :780    """Reduce `Ostap.Math.CutOffStudent`781    - see `Ostap.Math.CutOffStudent`782    """783    return root_factory , ( type ( s ) , s.right () , s.x0 () , s.n() , s.sigma()  )784Ostap.Math.CutOffStudent. __reduce__ = _omcstt_reduce_785# =============================================================================786# Models2 787# =============================================================================788# =============================================================================789## Reduce Ostap::Math::PS2DPol790#  @see Ostap::Math::PS2DPol791def _omps2dpol_reduce_ ( s ) :792    """Reduce `Ostap.Math.PS2DPol`793    - see `Ostap.Math.PS2DPol`794    """795    return root_factory , ( type ( s ) , s.positive() , s.psx() , s.psy () )796Ostap.Math.PS2DPol. __reduce__ = _omps2dpol_reduce_797# =============================================================================798## Reduce Ostap::Math::PS2DPolSym799#  @see Ostap::Math::PS2DPolSym800def _omps2dpols_reduce_ ( s ) :801    """Reduce `Ostap.Math.PS2DPolSym`802    - see `Ostap.Math.PS2DPolSym`803    """804    return root_factory , ( type ( s ) , s.positive() , s.psx() )805Ostap.Math.PS2DPolSym. __reduce__ = _omps2dpols_reduce_806# =============================================================================807## Reduce Ostap::Math::PS2DPol2808#  @see Ostap::Math::PS2DPol2809def _omps2dpol2_reduce_ ( s ) :810    """Reduce `Ostap.Math.PS2DPol2`811    - see `Ostap.Math.PS2DPol2`812    """813    return root_factory , ( type ( s ) , s.positive() , s.psx() , s.psy () , s.mmax() )814Ostap.Math.PS2DPol2. __reduce__ = _omps2dpol2_reduce_815# =============================================================================816## Reduce Ostap::Math::PS2DPol2Sym817#  @see Ostap::Math::PS2DPol2Sym818def _omps2dpol2s_reduce_ ( s ) :819    """Reduce `Ostap.Math.PS2DPol2Sym`820    - see `Ostap.Math.PS2DPol2Sym`821    """822    return root_factory , ( type ( s ) , s.positive() , s.psx() , s.mmax () )823Ostap.Math.PS2DPol2Sym. __reduce__ = _omps2dpol2s_reduce_824# =============================================================================825## Reduce Ostap::Math::PS2DPol3826#  @see Ostap::Math::PS2DPol3827def _omps2dpol3_reduce_ ( s ) :828    """Reduce `Ostap.Math.PS2DPol3`829    - see `Ostap.Math.PS2DPol3`830    """831    return root_factory , ( type ( s ) , s.psx() , s.psy () , s.mmax() )832Ostap.Math.PS2DPol3. __reduce__ = _omps2dpol3_reduce_833# =============================================================================834## Reduce Ostap::Math::PS2DPol3Sym835#  @see Ostap::Math::PS2DPol3Sym836def _omps2dpol3s_reduce_ ( s ) :837    """Reduce `Ostap.Math.PS2DPol3Sym`838    - see `Ostap.Math.PS2DPol3Sym`839    """840    return root_factory , ( type ( s ) , s.psx() , s.mmax () )841Ostap.Math.PS2DPol3Sym. __reduce__ = _omps2dpol3s_reduce_842# =============================================================================843## Reduce Ostap::Math::ExpoPS2DPol844#  @see Ostap::Math::ExpoPS2DPol845def _omeps2dpol_reduce_ ( s ) :846    """Reduce `Ostap.Math.ExpoPS2DPol`847    - see `Ostap.Math.ExpoPS2DPol`848    """849    return root_factory , ( type ( s ) , s.positive () , s.psy () , s.tau() )850Ostap.Math.ExpoPS2DPol. __reduce__ = _omeps2dpol_reduce_851# =============================================================================852## Reduce Ostap::Math::Expo2DPol853#  @see Ostap::Math::Expo2DPol854def _ome2dpol_reduce_ ( s ) :855    """Reduce `Ostap.Math.Expo2DPol`856    - see `Ostap.Math.Expo2DPol`857    """858    return root_factory , ( type ( s ) , s.positive () , s.tauX () , s.tauY() )859Ostap.Math.Expo2DPol. __reduce__ = _ome2dpol_reduce_860# =============================================================================861## Reduce Ostap::Math::Expo2DPolSym862#  @see Ostap::Math::Expo2DPolSym863def _ome2dpols_reduce_ ( s ) :864    """Reduce `Ostap.Math.Expo2DPolSym`865    - see `Ostap.Math.Expo2DPolSym`866    """867    return root_factory , ( type ( s ) , s.positive () , s.tau () )868Ostap.Math.Expo2DPolSym. __reduce__ = _ome2dpols_reduce_869# =============================================================================870## Reduce Ostap::Math::Gauss2D871#  @see Ostap::Math::Gauss2D872def _omg2d_reduce_ ( s ) :873    """Reduce `Ostap.Math.Gauss2D`874    - see `Ostap.Math.Gauss2D`875    """876    return root_factory , ( type ( s ) ,877                            s.muX   () , s.muY    () ,878                            s.sigmaX() , s.msigmaY() , s.theta () )879Ostap.Math.Gauss2D. __reduce__ = _omg2d_reduce_880# =============================================================================881##  Models3  882# =============================================================================883# =============================================================================884## Reduce Ostap::Math::Gauss3D885#  @see Ostap::Math::Gauss3D886def _omg3d_reduce_ ( s ) :887    """Reduce `Ostap.Math.Gauss3D`888    - see `Ostap.Math.Gauss3D`889    """890    return root_factory , ( type ( s ) ,891                            s.muX   () , s.muY    () , s.muZ    () ,                            892                            s.sigmaX() , s.msigmaY() , s.msigmaZ() ,893                            s.phi   () , s.theta  () , s.psi    () )894Ostap.Math.Gauss3D. __reduce__ = _omg3d_reduce_895# =============================================================================896_new_methods_ = [] 897_decorated_classes_  = (898    ## Formfactors 899    Ostap.Math.FormFactors.Jackson          ,900    Ostap.Math.FormFactors.BlattWeisskopf   ,901    Ostap.Math.FormFactors.NoFormFactor     ,902    ## Channels 903    Ostap.Math.ChannelCW                    , 904    Ostap.Math.ChannelQ                     ,905    Ostap.Math.ChannelFlatte                ,906    Ostap.Math.Channel                      ,907    Ostap.Math.Channel0                     ,908    Ostap.Math.Channel23L                   ,909    Ostap.Math.ChannelNR3                   ,910    Ostap.Math.ChannelGS                    ,911    ## Breit-Wigners 912    Ostap.Math.BW                           ,913    Ostap.Math.BreitWigner                  ,914    Ostap.Math.Rho0                         , 915    Ostap.Math.Phi0                         ,916    Ostap.Math.Kstar0                       ,917    Ostap.Math.BreitWignerMC                ,918    Ostap.Math.Flatte                       ,919    Ostap.Math.LASS                         ,920    Ostap.Math.BWPS                         ,921    Ostap.Math.BW3L                         ,922    Ostap.Math.A2                           ,923    ## peaks924    Ostap.Math.BifurcatedGauss              , 925    Ostap.Math.DoubleGauss                  , 926    Ostap.Math.Gauss                        , 927    Ostap.Math.GenGaussV1                   ,928    Ostap.Math.GenGaussV2                   , 929    Ostap.Math.SkewGauss                    , 930    Ostap.Math.ExGauss                      , 931    Ostap.Math.NormalLaplace                , 932    Ostap.Math.Bukin                        , 933    Ostap.Math.Novosibirsk                  , 934    Ostap.Math.CrystalBall                  , 935    Ostap.Math.CrystalBallRightSide         , 936    Ostap.Math.Needham                      , 937    Ostap.Math.CrystalBallDoubleSided       , 938    Ostap.Math.Apollonios                   , 939    Ostap.Math.Apollonios2                  , 940    Ostap.Math.StudentT                     , 941    Ostap.Math.BifurcatedStudentT           , 942    Ostap.Math.PearsonIV                    , 943    Ostap.Math.SinhAsinh                    , 944    Ostap.Math.JohnsonSU                    , 945    Ostap.Math.Atlas                        , 946    Ostap.Math.Sech                         , 947    Ostap.Math.Logistic                     , 948    Ostap.Math.Losev                        , 949    Ostap.Math.Slash                        ,     950    Ostap.Math.AsymmetricLaplace            , 951    Ostap.Math.RaisingCosine                , 952    Ostap.Math.QGaussian                    , 953    Ostap.Math.Hyperbolic                   , 954    Ostap.Math.GenHyperbolic                , 955    Ostap.Math.Das                          , 956    Ostap.Math.Hat                          , 957    Ostap.Math.Up                           , 958    Ostap.Math.FupN                         ,959    ## models960    Ostap.Math.Gumbel                       , 961    Ostap.Math.GramCharlierA                , 962    Ostap.Math.PhaseSpacePol                , 963    Ostap.Math.PhaseSpaceLeftExpoPol        , 964    Ostap.Math.GammaDist                    , 965    Ostap.Math.LogGammaDist                 , 966    Ostap.Math.Log10GammaDist               , 967    Ostap.Math.GenGammaDist                 , 968    Ostap.Math.LogGamma                     , 969    Ostap.Math.BetaPrime                    , 970    Ostap.Math.Landau                       , 971    Ostap.Math.Weibull                      , 972    Ostap.Math.ExpoPositive                 , 973    Ostap.Math.Sigmoid                      , 974    Ostap.Math.TwoExpos                     , 975    Ostap.Math.TwoExpoPositive              , 976    Ostap.Math.Rice                         , 977    Ostap.Math.GenInvGauss                  , 978    Ostap.Math.Argus                        , 979    Ostap.Math.GenArgus                     , 980    Ostap.Math.Tsallis                      , 981    Ostap.Math.QGSM                         , 982    Ostap.Math.HORNSdini                    , 983    Ostap.Math.HILLdini                     , 984    Ostap.Math.CutOffGauss                  , 985    Ostap.Math.CutOffStudent                ,986    ## 2D-models987    Ostap.Math.PS2DPol                      , 988    Ostap.Math.PS2DPolSym                   , 989    Ostap.Math.PS2DPol2                     , 990    Ostap.Math.PS2DPol2Sym                  , 991    Ostap.Math.PS2DPol3                     , 992    Ostap.Math.PS2DPol3Sym                  , 993    Ostap.Math.ExpoPS2DPol                  , 994    Ostap.Math.Expo2DPol                    , 995    Ostap.Math.Expo2DPolSym                 , 996    Ostap.Math.Gauss2D                      ,997    ## 3D-models 998    Ostap.Math.Gauss3D                      ,     999)1000for t in _decorated_classes_ :1001    _new_methods_.append ( t.__reduce__  )1002_new_methods_ = tuple ( _new_methods_ ) 1003# =============================================================================1004if '__main__' == __name__ :1005    1006    from ostap.utils.docme import docme1007    docme ( __name__ , logger = logger )1008# =============================================================================1009##                                                                      The END ...reduce.py
Source:reduce.py  
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3# =============================================================================4## @file ostap/math/reduce.py5#  Module with some useful utilities for reducing some math objects 6# =============================================================================7__version__ = "$Revision$"8__author__  = "Vanya BELYAEV Ivan.Belyaev@cern.ch"9__date__    = "2011-12-01"10__all__     = (11    'root_factory' , ## a simple factory to generic deseroialisarion12    )13# =============================================================================14from    ostap.math.base        import Ostap, doubles 15from    ostap.core.ostap_types import sequence_types 16import  ROOT, array 17# =============================================================================18# logging 19# =============================================================================20from   ostap.logger.logger import getLogger 21if '__main__' ==  __name__ : logger = getLogger ( 'ostap.math.reduce' )22else                       : logger = getLogger ( __name__            )23# =============================================================================24## Trivial factory for deserialization of generic objects25def root_factory ( klass , *params ) :26    """Trivial factory for deserialization of generic bjects27    """28    return klass ( *params )29# =============================================================================30## Simple (basic) polynomials 31# =============================================================================   32# =============================================================================33## factory for deserialization of simple polynomians 34#  @see Ostap.Math.Chebyshev  35#  @see Ostap.Math.ChebyshevU  36#  @see Ostap.Math.Hermite     37#  @see Ostap.Math.Legendre38#  @see Ostap.Math.PLegendre39def pN_factory ( klass , *args ) :40    """Factory for deserialization of simple polynomians41    - see Ostap.Math.Chebyshev  42    - see Ostap.Math.ChebyshevU 43    - see Ostap.Math.Hermite    44    - see Ostap.Math.Legendre  45    - see Ostap.Math.PLegendre  46    """47    return klass ( *args ) 48# =============================================================================49## reduce simple polynomials50#  @see Ostap.Math.Chebyshev  51#  @see Ostap.Math.ChebyshevU  52#  @see Ostap.Math.Hermite     53#  @see Ostap.Math.Legendre   54def pN_reduce ( p ) :55    """Reduce simple polynomials56    - see Ostap.Math.Chebyshev  57    - see Ostap.Math.ChebyshevU 58    - see Ostap.Math.Hermite    59    - see Ostap.Math.Legendre  60    """61    return pN_factory ,  ( type ( p ) , p.degree() ) 62# =============================================================================63## reduce simple polynomials64#  @see Ostap.Math.PLegendre   65def pLM_reduce ( p ) :66    """Reduce simple polynomials67    - see Ostap.Math.PLegendre  68    """69    return pN_factory ,  ( type ( p ) , p.L() , p.M() ) 70for t in ( Ostap.Math.Chebyshev  ,71           Ostap.Math.ChebyshevU , 72           Ostap.Math.Hermite    , 73           Ostap.Math.Legendre   ) :74    75    t.__reduce__ = pN_reduce76for t in ( Ostap.Math.Chebyshev  ,77           Ostap.Math.ChebyshevU , 78           Ostap.Math.Hermite    , 79           Ostap.Math.Legendre   ) :80    81    t.__reduce__ = pN_reduce82    83Ostap.Math.PLegendre.__reduce__ = pLM_reduce 84# =============================================================================85## Regular polynomials  86# =============================================================================   87# =============================================================================88## factory for deserisalization of polynomials with parameters89#  @see Ostap::Math::Polynomial90#  @see Ostap::Math::ChebyshevSum91#  @see Ostap::Math::LegendreSum92#  @see Ostap::Math::HermiteSum93#  @see Ostap::Math::Bernstein94#  @see Ostap::Math::BernsteinEven95def poly_factory ( klass , params , *args ) :96    """Factory for deserisalization of polynomials with parameters97    - see Ostap.Math.Polynomial98    - see Ostap.Math.ChebyshevSum99    - see Ostap.Math.LegendreSum100    - see Ostap.Math.HermiteSum101    - see Ostap.Math.Bernstein102    - see Ostap.Math.BernsteinEven103    """104    return klass ( doubles ( params ) , *args ) 105# =============================================================================106## Reduce polynomials with parameters107#  @see Ostap::Math::Polynomial108#  @see Ostap::Math::ChebyshevSum109#  @see Ostap::Math::LegendreSum110#  @see Ostap::Math::HermiteSum111#  @see Ostap::Math::Bernstein112#  @see Ostap::Math::BernsteinEven113#  @see Ostap::Math::Positive 114def poly_reduce ( p ) : 115    """Reduce polynomials with parameters116    - see Ostap.Math.Polynomial117    - see Ostap.Math.ChebyshevSum118    - see Ostap.Math.LegendreSum119    - see Ostap.Math.HermiteSum120    - see Ostap.Math.Bernstein121    - see Ostap.Math.BernsteinEven122    - see Ostap.Math.Positive 123    - see Ostap.Math.PositiveEven 124    """125    return poly_factory , ( type ( p ) ,126                            array.array ( 'd' ,  p.pars() ) ,127                            p.xmin () ,128                            p.xmax () )129    130for t in (  Ostap.Math.Polynomial     , 131            Ostap.Math.ChebyshevSum   , 132            Ostap.Math.LegendreSum    , 133            Ostap.Math.HermiteSum     , 134            Ostap.Math.Bernstein      , 135            Ostap.Math.BernsteinEven  ,136            Ostap.Math.Positive       , 137            Ostap.Math.PositiveEven   ) :138    139    t.__reduce__ = poly_reduce140    141# =============================================================================142## Specific forms of Bernstein  polynomials 143# =============================================================================144# =============================================================================145## reduce monotonic polynomial146#  @see Ostap::Math::Monotonic 147def pm_reduce ( p ) :148    """reduce monotonic polynomial149    - see Ostap.Math.Monotonic150    """151    return poly_factory , ( type ( p ) ,152                            array.array ( 'd' , p.pars() ) ,153                            p.xmin () ,154                            p.xmax () ,155                            True if p.increasing() else False )156# =============================================================================157## reduce convex polynomial158#  @see Ostap::Math::Convex  159def pc_reduce ( p ) :160    """reduce convex polynomial161    - see Ostap.Math.Convex162    """163    return poly_factory , ( type ( p ) ,164                            array.array ( 'd' ,  p.pars() ) ,165                            p.xmin () ,166                            p.xmax () ,167                            True if p.increasing () else False , 168                            True if p.convex     () else False ) 169# =============================================================================170## reduce convex-only polynomial171#  @see Ostap::Math::ConvexOnly172def pco_reduce ( p ) :173    """reduce convex-only polynomial174    - see Ostap.Math.ConvexOnly175    """176    return poly_factory , ( type ( p ) ,177                            array.array ( 'd' , p.pars() ) ,178                            p.xmin () ,179                            p.xmax () ,180                            True if p.convex     () else False ) 181Ostap.Math.Monotonic  .__reduce__ =  pm_reduce182Ostap.Math.Convex     .__reduce__ =  pc_reduce183Ostap.Math.ConvexOnly .__reduce__ = pco_reduce184# =============================================================================185## B-splines 186# =============================================================================187# =============================================================================188## factory for deserisalization of splines 189#  @see Ostap::Math::BSPline 190#  @see Ostap::Math::PositiveSpline 191#  @see Ostap::Math::MonotonicSpline 192#  @see Ostap::Math::ConvexSpline 193#  @see Ostap::Math::ConvexOnlySpline 194def sp_factory ( klass , knots , pars , *args ) :195    """Factory for deserisalization of splines 196    - see Ostap.Math.BSPline 197    - see Ostap.Math.PositiveSpline 198    - see Ostap.Math.MonotonicSpline 199    - see Ostap.Math.ConvexSpline 200    - see Ostap.Math.ConvexOnlySpline 201    202    """203    return klass ( doubles ( knots) , doubles ( pars ) , *args ) 204# =============================================================================205## factory for deserisalization of splines 206#  @see Ostap::Math::BSPline 207#  @see Ostap::Math::PositiveSpline 208def sp_reduce (  sp ) :209    """Factory for deserisalization of splines 210    - see Ostap.Math.BSPline 211    - see Ostap.Math.PositiveSpline 212    """213    return sp_factory , ( type  ( sp ) ,214                          array.array ( 'd' , sp.knots() ) ,215                          array.array ( 'd' , sp.pars () ) ) 216Ostap.Math.BSpline        . __reduce__ = sp_reduce 217Ostap.Math.PositiveSpline . __reduce__ = sp_reduce 218# =============================================================================219## factory for deserisalization of splines 220#  @see Ostap::Math::MonotonicSpline 221def spm_reduce (  sp ) :222    """Factory for deserisalization of splines 223    - see Ostap.Math.MonotonicSpline 224    """225    return sp_factory , ( type  ( sp ) ,226                          array.array ( 'd' , sp.knots() ) ,227                          array.array ( 'd' , sp.pars () ) , 228                          True if sp.increasing () else False )229                          230# =============================================================================231## factory for deserisalization of splines 232#  @see Ostap::Math::ConvexSpline 233def spc_reduce (  sp ) :234    """Factory for deserisalization of splines 235    - see Ostap.Math.ConvexSpline 236    """237    return sp_factory , ( type  ( sp ) ,238                          array.array ( 'd' , sp.knots() ) ,239                          array.array ( 'd' , sp.pars () ) , 240                          True if sp.increasing () else False , 241                          True if sp.convex     () else False )242                          243# =============================================================================244## factory for deserisalization of splines 245#  @see Ostap::Math::ConvexOnlySpline 246def spco_reduce (  sp ) :247    """Factory for deserisalization of splines 248    - see Ostap.Math.ConvexOnlySpline 249    """250    return sp_factory , ( type  ( sp ) ,251                          array.array ( 'd' , sp.knots() ) ,252                          array.array ( 'd' , sp.pars () ) , 253                          True if p.convex     () else False )254                          255Ostap.Math.MonotonicSpline . __reduce__ = spm_reduce 256Ostap.Math.ConvexSpline . __reduce__ = spc_reduce 257Ostap.Math.ConvexOnlySpline . __reduce__ = spco_reduce 258# =============================================================================259## Interpolation stuff 260# =============================================================================261# ============================================================================262## factory for deserialisation of interpolation abscissas 263def abs_factory ( arg , *args ) :264    """Factory for deserialisation of interpolation abscissas265    """266    if isinstance ( arg , sequence_types ) :267        vals = doubles ( arg )268        return Ostap.Math.Interpolation.Abscissas ( vals , *args  )269    270    return Ostap.Math.Interpolation.Abscissas ( arg , *args ) 271# =============================================================================272## Reduce interpolation abscissas 273def abs_reduce ( a ) :274    """Reduce interpolation abscissas 275    """276    at = a.atype()277    if at in ( Ostap.Math.Interpolation.Abscissas.Uniform    ,278               Ostap.Math.Interpolation.Abscissas.Chebyshev  ,279               Ostap.Math.Interpolation.Abscissas.Chebyshev2 ) :280        return abs_factory, ( a.n () , a.xmin() , a.xmax () , int ( at ) )281    return abs_factory, ( array.array ('d' , a.x() ) , ) 282# ============================================================================283## the factory for serialisation of the interpolation table 284def tab_factory ( abscissas , values ) :285    """The factory for serialisation of the interpolation table286    """287    return Ostap.Math.Interpolation.Table ( abscissas , doubles ( values ) ) 288## ===========================================================================289## Reduce the interpolation table 290def tab_reduce ( table ) :291    """Reduce the interpolation table"""292    return tab_factory , ( table.abscissas ()              ,293                           array.array ( 'd' , table.values () ) )294Ostap.Math.Interpolation.Abscissas . __reduce__ = abs_reduce 295Ostap.Math.Interpolation.Table     . __reduce__ = tab_reduce296# ============================================================================297## the factory for serialisation of the interpolation objects 298def int_factory ( klass , abscissas , values , *args ) :299    """The factory for serialisation of the interpolation table300    """301    the_table = Ostap.Math.Interpolation.Table ( abscissas , doubles ( values ) )302    return klass ( the_table , *args )303## ===========================================================================304## Reduce the interpolation object 305def int_reduce ( table ) :306    """Reduce the interpolation object"""307    return int_factory , ( type ( table )                  ,308                           table.abscissas ()              ,309                           array.array ( 'd' , table.values () ) ) 310## ===========================================================================311## Reduce the interpolation Floater-Hormann interpolant 312def intfh_reduce ( table ) :313    """Reduce the Floater-Hormann interpolant"""314    return int_factory , ( type ( table )                  ,315                           table.abscissas ()              ,316                           array.array ( 'd' , table.values () ) , 317                           table.d ()                      ) 318for t in ( Ostap.Math.Neville     ,319           Ostap.Math.Lagrange    , 320           Ostap.Math.Newton      , 321           Ostap.Math.Barycentric , 322           Ostap.Math.Berrut1st   , 323           Ostap.Math.Berrut2nd   ) :324    325    t.__reduce__ = int_reduce 326Ostap.Math.FloaterHormann. __reduce__ = intfh_reduce 327# =============================================================================328## Dalitz' objects 329# =============================================================================   330# ============================================================================331## Serialise class <code>Ostap::Kinematics::Dalitz0</code>332#  @see Ostap::Kinematcis.Dalitz0333def _dalitz0_reduce_ ( dalitz ) :334    """Serialise class `Ostap.Kinematics.Dalitz0`335    - see Ostap.Kinematics.Dalitz0336    """337    return root_factory , ( type ( dalitz ) ,338                            dalitz.m1 () ,339                            dalitz.m2 () ,340                            dalitz.m3 () ) 341# ============================================================================342## Serialise class <code>Ostap::Kinematics::Dalitz</code>343#  @see Ostap::Kinematcis.Dalitz344def _dalitzm_reduce_ ( dalitz ) :345    """Serialise class `Ostap.Kinematics.Dalitz`346    - see Ostap.Kinematics.Dalitz347    """348    return root_factory , ( type ( dalitz ) ,349                            dalitz.M  () , 350                            dalitz.m1 () ,351                            dalitz.m2 () ,352                            dalitz.m3 () ) 353Ostap.Kinematics.Dalitz0. __reduce__ = _dalitz0_reduce_ 354Ostap.Kinematics.Dalitz . __reduce__ = _dalitzm_reduce_   355# =============================================================================356## (Redefine standard constructor to allow usage of python lists&tuples)357#  Lists and tuples are converted on flight to :358# - std::vector<double> 359def _new_init_ ( t ,  *args )  :360    """(Redefine standard constructor to allow usage of python lists&tuples)361    Lists and tuples are  converted on flight to :362    - std::vector<double> 363    """364    from ostap.math.base        import doubles  , VCT_TYPES 365    from ostap.core.ostap_types import Generator, Sequence, list_types  366    367    largs = list (  args )368    for i , arg in enumerate ( largs ) :369        370        if   isinstance ( arg , VCT_TYPES  ) : continue 371        372        if   isinstance ( arg , Generator  ) : pass373        elif isinstance ( arg , Sequence   ) : pass374        elif isinstance ( arg , list_types ) : pass375        else :376            continue377        378        try: 379            _arg = doubles  ( arg  )380            largs [ i ] = _arg381            continue 382        except TypeError : pass383                384    targs = tuple ( largs )385        386    ## use old constructor 387    return t._old_init_ ( *targs ) 388# =============================================================================389for p in ( Ostap.Math.Polynomial    , 390           Ostap.Math.ChebyshevSum  , 391           Ostap.Math.LegendreSum   , 392           Ostap.Math.HermiteSum    ) :393    394    if not hasattr ( p , '_old_init_' ) :395        396        p._old_init_ = p.__init__397        ## Modifed constructor to allow python lists/tuples398        def _p_new_init_ ( s ,  *args ) :399            """Modifed constructor to allow python lists/tuples400            """401            _new_init_ ( s , *args )402            403        _p_new_init_.__doc__ += '\n' +   _new_init_.__doc__ 404        _p_new_init_.__doc__ += '\n' + p._old_init_.__doc__ 405        p.__init__ = _p_new_init_ 406# =============================================================================407## several Ostap::Math objects408# =============================================================================409## reduce CutOffGauss410def _rm_cgau_reduce_ ( o )  :411    return root_factory , ( type ( o ) , o.right() , o.x0() , o.sigma() )412Ostap.Math.CutOffGauss.__reduce__ = _rm_cgau_reduce_413# =============================================================================414## reduce CutOffStudent415def _rm_cstt_reduce_ ( o )  :416    return root_factory , ( type ( o ) , o.right() , o.x0() , o.nu () , o.sigma() )417Ostap.Math.CutOffStudent.__reduce__ = _rm_cstt_reduce_418# =============================================================================419## reduce PhaseSpace2420def _rm_ps2_reduce_ ( o ) :421    return root_factory , ( type ( o ) , o.m1 () , o.m2() )422Ostap.Math.PhaseSpace2.__reduce__ = _rm_ps2_reduce_423# =============================================================================424## reduce PhaseSpace3425def _rm_ps3_reduce_ ( o ) :426    return root_factory , ( type ( o ) , o.m1 () , o.m2() , o.m3 () )427Ostap.Math.PhaseSpace3 .__reduce__ = _rm_ps3_reduce_428Ostap.Math.PhaseSpace3s.__reduce__ = _rm_ps3_reduce_429# =============================================================================430## reduce PhaseSpaceNL431def _rm_psnl_reduce_ ( o ) :432    return root_factory , ( type ( o ) , o.lowEdge() , o.highEdge() , o.L () , o.N () )433Ostap.Math.PhaseSpaceNL .__reduce__ = _rm_psnl_reduce_434# =======================================================================435## reduce PhasSpaceRight 436def _rm_psr_reduce_ ( o ) :437    """Reduce PhasSpaceRight"""438    return root_factory , ( type ( o ) , o.threshold () , o.L () , o.N () )439Ostap.Math.PhaseSpaceRight .__reduce__ = _rm_psr_reduce_440# ========================================================================441## reduce PhasSpaceLeft 442def _rm_psl_reduce_ ( o ) :443    """Reduce PhasSpaceLeft"""444    content = type ( o ) ,445    c = o.ps_case()446    if   o.TwoBody    == c : tail = o.ps2  () , o.scale() 447    elif o.ThreeBody  == c : tail = o.ps3  () , o.scale() 448    elif o.ThreeBodyS == c : tail = o.ps3s () , o.scale() 449    else                   : tail = o.threshold () , o.N() , o.scale ()  450    return root_factory , content + tail 451Ostap.Math.PhaseSpaceLeft .__reduce__ = _rm_psl_reduce_452# ========================================================================453## reduce PSDalitz 454def _rm_psd_reduce_ ( o ) :455    """Reduce PSDalitz"""456    return root_factory , ( type ( o )  , o.M() , o.m1() , o.m2() , o.m3() )457Ostap.Math.PSDalitz.__reduce__ = _rm_psd_reduce_458# ========================================================================459## reduce PhaseSpace23L460def _rm_ps23l_reduce_ ( o ) :461    """Reduce PhaseSpace23L"""462    return root_factory , ( type ( o )  ,463                            o.m1() , o.m2() , o.m3() , o.m () , o.L() , o.l () )464Ostap.Math.PSDalitz.__reduce__ = _rm_ps23l_reduce_465# ========================================================================466## reduce PhaseSpaceLeftExpoPol467def _rm_pslep_reduce_ ( o ) :468    """reduce PhaseSpaceLeftExpoPol"""469    return root_factory , ( type ( o )      ,470                            o.phasespace () ,471                            o.polynom    () ,472                            o.tau        () )  473Ostap.Math.PhaseSpaceLeftExpoPol .__reduce__ = _rm_pslep_reduce_474# =============================================================================475## reduce Histo1D476def _rm_h1d_reduce_ ( o ) :477    """reduce Histo1D"""478    return root_factory , ( type ( o ) , o.h () , o.t() ,479                            o.edges () , o.extrapolate() , o.density () )480# =============================================================================481## reduce Histo2D482def _rm_h2d_reduce_ ( o ) :483    """reduce Histo2D"""484    return root_factory , ( type ( o ) , o.h () , o.tx() , o.ty() ,485                            o.edges () , o.extrapolate() , o.density () )486# =============================================================================487## reduce Histo3D488def _rm_h3d_reduce_ ( o ) :489    """reduce Histo3D"""490    return root_factory , ( type ( o ) , o.h () , o.tx() , o.ty() , o.tz() ,491                            o.edges () , o.extrapolate() , o.density () )492# =============================================================================493Ostap.Math.Histo1D.__reduce__ = _rm_h1d_reduce_ 494Ostap.Math.Histo2D.__reduce__ = _rm_h2d_reduce_ 495Ostap.Math.Histo3D.__reduce__ = _rm_h3d_reduce_ 496# =============================================================================497# =============================================================================498## decorated classes 499_decorated_classes_  = (500    ## 501    Ostap.Math.Chebyshev               ,502    Ostap.Math.ChebyshevU              , 503    Ostap.Math.Hermite                 , 504    Ostap.Math.Legendre                , 505    Ostap.Math.PLegendre               ,506    ## 507    Ostap.Math.Polynomial              , 508    Ostap.Math.ChebyshevSum            , 509    Ostap.Math.LegendreSum             , 510    Ostap.Math.HermiteSum              , 511    Ostap.Math.Bernstein               , 512    Ostap.Math.BernsteinEven           ,513    Ostap.Math.Positive                , 514    Ostap.Math.PositiveEven            , 515    ##516    Ostap.Math.Monotonic               , 517    Ostap.Math.Convex                  , 518    Ostap.Math.ConvexOnly              , 519    ##520    Ostap.Math.BSpline                 , 521    Ostap.Math.PositiveSpline          ,522    ## 523    Ostap.Math.MonotonicSpline         ,524    Ostap.Math.ConvexSpline            ,525    Ostap.Math.ConvexOnlySpline        , 526    ##527    Ostap.Math.Interpolation.Abscissas , 528    Ostap.Math.Interpolation.Table     , 529    ##530    Ostap.Math.Neville                 ,531    Ostap.Math.Lagrange                , 532    Ostap.Math.Newton                  , 533    Ostap.Math.Barycentric             , 534    Ostap.Math.Berrut1st               , 535    Ostap.Math.Berrut2nd               , 536    Ostap.Math.FloaterHormann          , 537    ##538    Ostap.Kinematics.Dalitz0           , 539    Ostap.Kinematics.Dalitz            ,540    ##541    Ostap.Math.Histo1D                 ,542    Ostap.Math.Histo2D                 ,543    Ostap.Math.Histo3D                 ,544    ##545    Ostap.Math.CutOffGauss             , 546    Ostap.Math.CutOffStudent           ,547    ##548    Ostap.Math.PhaseSpace2             , 549    Ostap.Math.PhaseSpace3             , 550    Ostap.Math.PhaseSpace3s            , 551    Ostap.Math.PhaseSpaceNL            , 552    )553# =============================================================================554## new methdods 555_new_methods_       = (556    ##557    Ostap.Math.Chebyshev               . __reduce__  , 558    Ostap.Math.ChebyshevU              . __reduce__  , 559    Ostap.Math.Hermite                 . __reduce__  , 560    Ostap.Math.Legendre                . __reduce__  , 561    Ostap.Math.PLegendre               . __reduce__  , 562    ##563    Ostap.Math.Polynomial              . __reduce__  , 564    Ostap.Math.ChebyshevSum            . __reduce__  ,  565    Ostap.Math.LegendreSum             . __reduce__  ,  566    Ostap.Math.HermiteSum              . __reduce__  , 567    Ostap.Math.Bernstein               . __reduce__  , 568    Ostap.Math.BernsteinEven           . __reduce__  , 569    Ostap.Math.Positive                . __reduce__  , 570    Ostap.Math.PositiveEven            . __reduce__  , 571    ## 572    Ostap.Math.Monotonic               . __reduce__  , 573    Ostap.Math.Convex                  . __reduce__  ,574    Ostap.Math.ConvexOnly              . __reduce__  ,575    ##576    Ostap.Math.BSpline                 . __reduce__  , 577    Ostap.Math.PositiveSpline          . __reduce__  ,578    ## 579    Ostap.Math.MonotonicSpline         . __reduce__  , 580    Ostap.Math.ConvexSpline            . __reduce__  ,581    Ostap.Math.ConvexOnlySpline        . __reduce__  ,582    ##583    Ostap.Math.Interpolation.Abscissas . __reduce__  , 584    Ostap.Math.Interpolation.Table     . __reduce__  , 585    ##586    Ostap.Math.Neville                 . __reduce__  ,587    Ostap.Math.Lagrange                . __reduce__  ,  588    Ostap.Math.Newton                  . __reduce__  ,  589    Ostap.Math.Barycentric             . __reduce__  ,  590    Ostap.Math.Berrut1st               . __reduce__  ,  591    Ostap.Math.Berrut2nd               . __reduce__  , 592    Ostap.Math.FloaterHormann          . __reduce__  ,593    ##594    Ostap.Kinematics.Dalitz0           . __reduce__  ,595    Ostap.Kinematics.Dalitz            . __reduce__  ,596    ##597    Ostap.Math.Histo1D                 . __reduce__  ,598    Ostap.Math.Histo2D                 . __reduce__  ,599    Ostap.Math.Histo3D                 . __reduce__  ,600    ##601    Ostap.Math.CutOffGauss             . __reduce__  , 602    Ostap.Math.CutOffStudent           . __reduce__  ,603    Ostap.Math.PhaseSpace2             . __reduce__  , 604    Ostap.Math.PhaseSpace3             . __reduce__  , 605    Ostap.Math.PhaseSpace3s            . __reduce__  , 606    Ostap.Math.PhaseSpaceNL            . __reduce__  ,607    ##608    )609import ostap.math.more_reduce610# =============================================================================611if '__main__' == __name__ :612    613    from ostap.utils.docme import docme614    docme ( __name__ , logger = logger )615# =============================================================================616##                                                                      The END ...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
