#NEWLINE# def periodic_model( lomb_model ) : #NEWLINE# #INDENT# '\n    Compute features related to the extreme points of the fitted Lomb Scargle\n    model.\n    ' #NEWLINE# out_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# A = lomb_model [ 'freq_fits' ] [ 0 ] [ 'amplitude' ] #NEWLINE# ph = lomb_model [ 'freq_fits' ] [ 0 ] [ 'rel_phase' ] #NEWLINE# def model_f( t ) : #NEWLINE# #INDENT# return ( ( ( ( ( ( ( ( A [ 0 ] * np . sin ( ( ( ( 2.0 * np . pi ) * t ) + ph [ 0 ] ) ) ) + ( A [ 1 ] * np . sin ( ( ( ( ( 2.0 * np . pi ) * 2.0 ) * t ) + ph [ 1 ] ) ) ) ) + ( A [ 2 ] * np . sin ( ( ( ( ( 2.0 * np . pi ) * 3.0 ) * t ) + ph [ 2 ] ) ) ) ) + ( A [ 3 ] * np . sin ( ( ( ( ( 2.0 * np . pi ) * 4.0 ) * t ) + ph [ 3 ] ) ) ) ) + ( A [ 4 ] * np . sin ( ( ( ( ( 2.0 * np . pi ) * 5.0 ) * t ) + ph [ 4 ] ) ) ) ) + ( A [ 5 ] * np . sin ( ( ( ( ( 2.0 * np . pi ) * 6.0 ) * t ) + ph [ 5 ] ) ) ) ) + ( A [ 6 ] * np . sin ( ( ( ( ( 2.0 * np . pi ) * 7.0 ) * t ) + ph [ 6 ] ) ) ) ) + ( A [ 7 ] * np . sin ( ( ( ( ( 2.0 * np . pi ) * 8.0 ) * t ) + ph [ 7 ] ) ) ) ) #NEWLINE# #UNINDENT# def model_neg( t ) : #NEWLINE# #INDENT# return ( ( - 1.0 ) * model_f ( t ) ) #NEWLINE# #UNINDENT# min_1_a = optimize . fmin ( model_neg , 0.05 , disp = False ) [ 0 ] #NEWLINE# max_2_a = optimize . fmin ( model_f , ( min_1_a + 0.01 ) , disp = False ) [ 0 ] #NEWLINE# min_3_a = optimize . fmin ( model_neg , ( max_2_a + 0.01 ) , disp = False ) [ 0 ] #NEWLINE# max_4_a = optimize . fmin ( model_f , ( min_3_a + 0.01 ) , disp = False ) [ 0 ] #NEWLINE# out_dict [ 'phi1_phi2' ] = ( ( min_3_a - max_2_a ) / ( max_4_a / min_3_a ) ) #NEWLINE# out_dict [ 'min_delta_mags' ] = abs ( ( model_f ( min_1_a ) - model_f ( min_3_a ) ) ) #NEWLINE# out_dict [ 'max_delta_mags' ] = abs ( ( model_f ( model_neg ) - model_f ( max_4_a ) ) ) #NEWLINE# return out_dict