Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factorise la formule des crédits d'impôt #1304

Merged
merged 2 commits into from
Apr 8, 2019
Merged

Conversation

Morendil
Copy link
Contributor

@Morendil Morendil commented Apr 8, 2019

Merci de contribuer à OpenFisca ! Effacez cette ligne ainsi que, pour chaque ligne ci-dessous, les cas ne correspondant pas à votre contribution :)

  • Amélioration technique.
  • Périodes concernées : depuis 2002.
  • Zones impactées : credits_impots.
  • Détails :
    • Factorise la formule générale des crédits d'impôt

Ces changements (effacez les lignes ne correspondant pas à votre cas) :

  • Corrigent ou améliorent un calcul déjà existant.

Quelques conseils à prendre en compte :

Et surtout, n'hésitez pas à demander de l'aide ! :)

Fixes #1202

Copy link
Contributor

@claireleroy claireleroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok pour moi ! Cela me paraît bon pour merger !

@Morendil Morendil merged commit a8c9c11 into master Apr 8, 2019
@bonjourmauko bonjourmauko deleted the factorise-credits-impots branch April 14, 2019 16:53
]

montants = [around(foyer_fiscal(credit, period)) for credit in credits]
total_credits = sum(montants)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Morendil Hello, juste une question, désolé pour le retard : cela marche-t-il bien avec sum au lieu de numpy.sum ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui, sum([a,b,c…z]) est la même chose que a+b+c…+z donc c'est au pire équivalent à la formulation précédente.

Utiliser numpy.sum ne serait pas une optimisation mais plutôt le contraire:

>>> arrays = [np.random.rand(10000) for i in range(1000)]
>>> start = time(); foo = np.sum(arrays,axis=0); print(time()-start)
0.21930217742919922
>>> start = time(); foo = sum(arrays); print(time()-start)
0.04607868194580078

We follow two rules in the matter of optimization: Rule 1: Don't do it. Rule 2 (for experts only). Don't do it yet. -- Michael Jackson

😜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants