human
I am working on the file "PeriodWindowSimulation.ipynb".
The first task is:
Now a class to draw periods, as the setup is relatively expensive.
Can you write Python code for it?

=====
Write me a the Python code you requested?
assistant
#Here is the Python code you requested.

class DrawPeriods(object):
    
    def __init__(self, values):
        self.periods = np.asarray([2, 3.4, 5.9, 10, 17])
        self.values = values
        self.interp = interpolate.interp1d(self.values, self.periods)
        
    def draw(self):
        chosen_value = np.random.uniform(self.values.min(), self.values.max())
        return float(self.interp(chosen_value))
    
    @property
    def min_period(self):
        return self.periods.min()
    
    @property
    def max_period(self):
        return self.periods.max()
    
    @classmethod
    def large_neptunes(cls):
        values = np.asarray([0.004, 0.01, 0.12, 0.21, 0.49]) / 100.
        return cls(values)
    
    @classmethod
    def small_neptunes(cls):
        values = np.asarray([0.035, 0.22, 0.95, 2.88, 6.55]) / 100.
        return cls(values)