<s> from __future__ import print_function , division <EOL> import numpy as np <EOL> class OptThinRadius ( object ) : <EOL> def __init__ ( self , temperature , value = <NUM_LIT:1.> , min = <NUM_LIT:0.> ) : <EOL> self . temperature = temperature <EOL> self . value = value <EOL> self . min = <NUM_LIT:0.> <EOL> def __mul__ ( self , value ) : <EOL> return OptThinRadius ( self . temperature , value = self . value * value ) <EOL> def __rmul__ ( self , value ) : <EOL> return OptThinRadius ( self . temperature , value = self . value * value ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % ( self . value , self . temperature ) <EOL> def evaluate ( self , star , dust ) : <EOL> rstar = star . radius <EOL> tstar = star . effective_temperature ( ) <EOL> nu_min , nu_max = dust . optical_properties . nu [ <NUM_LIT:0> ] , dust . optical_properties . nu [ - <NUM_LIT:1> ] <EOL> nu , fnu = star . total_spectrum ( bnu_range = ( nu_min , nu_max ) ) <EOL> x = ( self . temperature / tstar ) ** <NUM_LIT> * dust . kappa_nu_temperature ( self . temperature ) / dust . kappa_nu_spectrum ( nu , fnu ) <EOL> if x < <NUM_LIT> : <EOL> r = self . value * rstar / <NUM_LIT> / np . sqrt ( x ) <EOL> else : <EOL> r = self . value * rstar / np . sqrt ( <NUM_LIT:1.> - ( <NUM_LIT:1.> - <NUM_LIT> * x ) ** <NUM_LIT> ) <EOL> if np . isnan ( r ) : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> return max ( r , self . min ) </s>
