def __init__(self, midi_file=None, resolution=220, initial_tempo=120.):
        if midi_file is not None:
            # Load in the MIDI data using the midi module
            midi_data = midi.read_midifile(midi_file)

            # Convert tick values in midi_data to absolute, a useful thing.
            midi_data.make_ticks_abs()

            # Store the resolution for later use
            self.resolution = midi_data.resolution

            # Populate the list of tempo changes (tick scales)
            self._load_tempo_changes(midi_data)

            # Update the array which maps ticks to time
            max_tick = max([max([e.tick for e in t]) for t in midi_data]) + 1
            # If max_tick is huge, the MIDI file is probably corrupt
            # and creating the __tick_to_time array will thrash memory
            if max_tick > MAX_TICK:
                raise ValueError(('MIDI file has a largest tick of {},'
                                  ' it is likely corrupt'.format(max_tick)))

            # Create list that maps ticks to time in seconds
            self._update_tick_to_time(max_tick)

            # Populate the list of key and time signature changes
            self._load_metadata(midi_data)

            # Check that there are tempo, key and time change events
            # only on track 0
            if sum([sum([isinstance(event, (midi.events.SetTempoEvent,
                                            midi.events.KeySignatureEvent,
                                            midi.events.TimeSignatureEvent))
                        for event in track]) for track in midi_data[1:]]):
                warnings.warn(("Tempo, Key or Time signature change events"
                               " found on non-zero tracks."
                               "  This is not a valid type 0 or type 1 MIDI"
                               " file. Tempo, Key or Time Signature"
                               " may be wrong."),
                              RuntimeWarning)

            # Populate the list of instruments
            self._load_instruments(midi_data)

        else:
            self.resolution = resolution
            # Compute the tick scale for the provided initial tempo
            # and let the tick scale start from 0
            self.__tick_scales = [(0, 60.0/(initial_tempo*self.resolution))]
            # Only need to convert one tick to time
            self.__tick_to_time = [0]
            # Empty instruments list
            self.instruments = []
            # Empty key signature changes list
            self.key_signature_changes = []
            # Empty time signatures changes list
            self.time_signature_changes = []
Initialize the PrettyMIDI container, either by populating it with
dataset/ETHPy150Open craffel/pretty-midi/pretty_midi/pretty_midi.py/PrettyMIDI.__init__