<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> import numpy as np <EOL> from acoustics . standards . iso_tr_25417_2007 import ( REFERENCE_PRESSURE , <EOL> sound_pressure_level , <EOL> equivalent_sound_pressure_level , <EOL> peak_sound_pressure , <EOL> peak_sound_pressure_level , <EOL> REFERENCE_SOUND_EXPOSURE , <EOL> sound_exposure , <EOL> sound_exposure_level , <EOL> REFERENCE_POWER , <EOL> sound_power_level , <EOL> sound_energy , <EOL> REFERENCE_ENERGY , <EOL> sound_energy_level , <EOL> sound_intensity , <EOL> time_averaged_sound_intensity , <EOL> REFERENCE_INTENSITY , <EOL> time_averaged_sound_intensity_level , <EOL> normal_time_averaged_sound_intensity , <EOL> normal_time_averaged_sound_intensity_level , <EOL> ) <EOL> from acoustics . standards . iso_1996_1_2003 import composite_rating_level <EOL> def _leq ( levels , time ) : <EOL> levels = np . asarray ( levels ) <EOL> return <NUM_LIT> * np . log10 ( ( <NUM_LIT:1.0> / time ) * np . sum ( <NUM_LIT> ** ( levels / <NUM_LIT> ) ) ) <EOL> def leq ( levels , int_time = <NUM_LIT:1.0> ) : <EOL> """<STR_LIT>""" <EOL> levels = np . asarray ( levels ) <EOL> time = levels . size * int_time <EOL> return _leq ( levels , time ) <EOL> def sel ( levels ) : <EOL> """<STR_LIT>""" <EOL> levels = np . asarray ( levels ) <EOL> return _leq ( levels , <NUM_LIT:1.0> ) <EOL> def lw ( W , Wref = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> W = np . asarray ( W ) <EOL> return <NUM_LIT> * np . log10 ( W / Wref ) <EOL> def lden ( lday , levening , lnight , hours = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , adjustment = ( <NUM_LIT:0.0> , <NUM_LIT> , <NUM_LIT> ) ) : <EOL> """<STR_LIT>""" <EOL> lday = np . asarray ( lday ) <EOL> levening = np . asarray ( levening ) <EOL> lnight = np . asarray ( lnight ) <EOL> return composite_rating_level ( np . vstack ( ( lday , levening , lnight ) ) . T , hours , adjustment ) <EOL> def ldn ( lday , lnight , hours = ( <NUM_LIT> , <NUM_LIT> ) , adjustment = ( <NUM_LIT:0.0> , <NUM_LIT> ) ) : <EOL> """<STR_LIT>""" <EOL> lday = np . asarray ( lday ) <EOL> lnight = np . asarray ( lnight ) <EOL> return composite_rating_level ( np . vstack ( ( lday , lnight ) ) . T , hours , adjustment ) </s>
