We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Using multiple SamplePulses with the same name overwritten in Qobj pulse library
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**:
- **Python version**:
- **Operating system**:

### What is the current behavior?
In the Qobj specification, pulse are identified by their name. In the pulse module pulses are identified by their object instance and when assembled are stored in the Qobj pulse library by name. If two `SamplePulse`s of the same name exist, the second will overwrite the first, causing undesired behaviour. 


### Steps to reproduce the problem
Create a pulse schedule with two different pulses of the same name and assemble into a Qobj.


### What is the expected behavior?
Unique pulses should be stored uniquely in the Qobj pulse library.


### Suggested solutions
If a name collision occurs when building the pulse library. Modify the name of the sample pulse in some consistent manner, and adjust the commands that refer to this pulse. 



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `qiskit/assembler/assemble_schedules.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 # This code is part of Qiskit.
4 #
5 # (C) Copyright IBM 2017, 2019.
6 #
7 # This code is licensed under the Apache License, Version 2.0. You may
8 # obtain a copy of this license in the LICENSE.txt file in the root directory
9 # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
10 #
11 # Any modifications or derivative works of this code must retain this
12 # copyright notice, and modified files need to carry a notice indicating
13 # that they have been altered from the originals.
14 
15 """Assemble function for converting a list of circuits into a qobj"""
16 from qiskit.exceptions import QiskitError
17 from qiskit.pulse.commands import PulseInstruction, AcquireInstruction
18 from qiskit.qobj import (PulseQobj, QobjExperimentHeader,
19                          PulseQobjInstruction, PulseQobjExperimentConfig,
20                          PulseQobjExperiment, PulseQobjConfig, PulseLibraryItem)
21 from qiskit.qobj.converters import InstructionToQobjConverter, LoConfigConverter
22 
23 
24 def assemble_schedules(schedules, qobj_id, qobj_header, run_config):
25     """Assembles a list of schedules into a qobj which can be run on the backend.
26     Args:
27         schedules (list[Schedule]): schedules to assemble
28         qobj_id (int): identifier for the generated qobj
29         qobj_header (QobjHeader): header to pass to the results
30         run_config (RunConfig): configuration of the runtime environment
31     Returns:
32         PulseQobj: the Qobj to be run on the backends
33     Raises:
34         QiskitError: when invalid schedules or configs are provided
35     """
36     if hasattr(run_config, 'instruction_converter'):
37         instruction_converter = run_config.instruction_converter
38     else:
39         instruction_converter = InstructionToQobjConverter
40 
41     qobj_config = run_config.to_dict()
42     qubit_lo_range = qobj_config.pop('qubit_lo_range')
43     meas_lo_range = qobj_config.pop('meas_lo_range')
44     meas_map = qobj_config.pop('meas_map', None)
45     instruction_converter = instruction_converter(PulseQobjInstruction, **qobj_config)
46 
47     lo_converter = LoConfigConverter(PulseQobjExperimentConfig, qubit_lo_range=qubit_lo_range,
48                                      meas_lo_range=meas_lo_range, **qobj_config)
49 
50     # Pack everything into the Qobj
51     qobj_schedules = []
52     user_pulselib = set()
53     for idx, schedule in enumerate(schedules):
54         # instructions
55         qobj_instructions = []
56         # Instructions are returned as tuple of shifted time and instruction
57         for shift, instruction in schedule.instructions:
58             # TODO: support conditional gate
59             qobj_instructions.append(instruction_converter(shift, instruction))
60             if isinstance(instruction, PulseInstruction):
61                 # add samples to pulse library
62                 user_pulselib.add(instruction.command)
63             if isinstance(instruction, AcquireInstruction):
64                 if meas_map:
65                     # verify all acquires satisfy meas_map
66                     _validate_meas_map(instruction, meas_map)
67 
68         # experiment header
69         qobj_experiment_header = QobjExperimentHeader(
70             name=schedule.name or 'Experiment-%d' % idx
71         )
72 
73         qobj_schedules.append({
74             'header': qobj_experiment_header,
75             'instructions': qobj_instructions
76         })
77 
78     # setup pulse_library
79     qobj_config['pulse_library'] = [PulseLibraryItem(name=pulse.name, samples=pulse.samples)
80                                     for pulse in user_pulselib]
81 
82     # create qobj experiment field
83     experiments = []
84     schedule_los = qobj_config.pop('schedule_los', [])
85 
86     if len(schedule_los) == 1:
87         lo_dict = schedule_los[0]
88         # update global config
89         q_los = lo_converter.get_qubit_los(lo_dict)
90         if q_los:
91             qobj_config['qubit_lo_freq'] = q_los
92         m_los = lo_converter.get_meas_los(lo_dict)
93         if m_los:
94             qobj_config['meas_lo_freq'] = m_los
95 
96     if schedule_los:
97         # multiple frequency setups
98         if len(qobj_schedules) == 1:
99             # frequency sweep
100             for lo_dict in schedule_los:
101                 experiments.append(PulseQobjExperiment(
102                     instructions=qobj_schedules[0]['instructions'],
103                     header=qobj_schedules[0]['header'],
104                     config=lo_converter(lo_dict)
105                 ))
106         elif len(qobj_schedules) == len(schedule_los):
107             # n:n setup
108             for lo_dict, schedule in zip(schedule_los, qobj_schedules):
109                 experiments.append(PulseQobjExperiment(
110                     instructions=schedule['instructions'],
111                     header=schedule['header'],
112                     config=lo_converter(lo_dict)
113                 ))
114         else:
115             raise QiskitError('Invalid LO setting is specified. '
116                               'The LO should be configured for each schedule, or '
117                               'single setup for all schedules (unique), or '
118                               'multiple setups for a single schedule (frequency sweep),'
119                               'or no LO configured at all.')
120     else:
121         # unique frequency setup
122         for schedule in qobj_schedules:
123             experiments.append(PulseQobjExperiment(
124                 instructions=schedule['instructions'],
125                 header=schedule['header'],
126             ))
127 
128     qobj_config = PulseQobjConfig(**qobj_config)
129 
130     return PulseQobj(qobj_id=qobj_id,
131                      config=qobj_config,
132                      experiments=experiments,
133                      header=qobj_header)
134 
135 
136 def _validate_meas_map(acquire, meas_map):
137     """Validate all qubits tied in meas_map are to be acquired."""
138     meas_map_set = [set(m) for m in meas_map]
139     # Verify that each qubit is listed once in measurement map
140     measured_qubits = {acq_ch.index for acq_ch in acquire.acquires}
141     tied_qubits = set()
142     for meas_qubit in measured_qubits:
143         for map_inst in meas_map_set:
144             if meas_qubit in map_inst:
145                 tied_qubits |= map_inst
146 
147     if measured_qubits != tied_qubits:
148         raise QiskitError('Qubits to be acquired: {0} do not satisfy required qubits '
149                           'in measurement map: {1}'.format(measured_qubits, tied_qubits))
150     return True
151
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/qiskit/assembler/assemble_schedules.py b/qiskit/assembler/assemble_schedules.py
--- a/qiskit/assembler/assemble_schedules.py
+++ b/qiskit/assembler/assemble_schedules.py
@@ -14,7 +14,7 @@
 
 """Assemble function for converting a list of circuits into a qobj"""
 from qiskit.exceptions import QiskitError
-from qiskit.pulse.commands import PulseInstruction, AcquireInstruction
+from qiskit.pulse.commands import PulseInstruction, AcquireInstruction, SamplePulse
 from qiskit.qobj import (PulseQobj, QobjExperimentHeader,
                          PulseQobjInstruction, PulseQobjExperimentConfig,
                          PulseQobjExperiment, PulseQobjConfig, PulseLibraryItem)
@@ -49,21 +49,28 @@
 
     # Pack everything into the Qobj
     qobj_schedules = []
-    user_pulselib = set()
+    user_pulselib = {}
     for idx, schedule in enumerate(schedules):
         # instructions
         qobj_instructions = []
         # Instructions are returned as tuple of shifted time and instruction
         for shift, instruction in schedule.instructions:
             # TODO: support conditional gate
-            qobj_instructions.append(instruction_converter(shift, instruction))
             if isinstance(instruction, PulseInstruction):
+                name = instruction.command.name
+                if name in user_pulselib and instruction.command != user_pulselib[name]:
+                    name = "{0}-{1:x}".format(name, hash(instruction.command.samples.tostring()))
+                    instruction = PulseInstruction(
+                        command=SamplePulse(name=name, samples=instruction.command.samples),
+                        name=instruction.name,
+                        channel=instruction.timeslots.channels[0])
                 # add samples to pulse library
-                user_pulselib.add(instruction.command)
+                user_pulselib[name] = instruction.command
             if isinstance(instruction, AcquireInstruction):
                 if meas_map:
                     # verify all acquires satisfy meas_map
                     _validate_meas_map(instruction, meas_map)
+            qobj_instructions.append(instruction_converter(shift, instruction))
 
         # experiment header
         qobj_experiment_header = QobjExperimentHeader(
@@ -77,7 +84,7 @@
 
     # setup pulse_library
     qobj_config['pulse_library'] = [PulseLibraryItem(name=pulse.name, samples=pulse.samples)
-                                    for pulse in user_pulselib]
+                                    for pulse in user_pulselib.values()]
 
     # create qobj experiment field
     experiments = []

{"golden_diff": "diff --git a/qiskit/assembler/assemble_schedules.py b/qiskit/assembler/assemble_schedules.py\n--- a/qiskit/assembler/assemble_schedules.py\n+++ b/qiskit/assembler/assemble_schedules.py\n@@ -14,7 +14,7 @@\n \n \"\"\"Assemble function for converting a list of circuits into a qobj\"\"\"\n from qiskit.exceptions import QiskitError\n-from qiskit.pulse.commands import PulseInstruction, AcquireInstruction\n+from qiskit.pulse.commands import PulseInstruction, AcquireInstruction, SamplePulse\n from qiskit.qobj import (PulseQobj, QobjExperimentHeader,\n                          PulseQobjInstruction, PulseQobjExperimentConfig,\n                          PulseQobjExperiment, PulseQobjConfig, PulseLibraryItem)\n@@ -49,21 +49,28 @@\n \n     # Pack everything into the Qobj\n     qobj_schedules = []\n-    user_pulselib = set()\n+    user_pulselib = {}\n     for idx, schedule in enumerate(schedules):\n         # instructions\n         qobj_instructions = []\n         # Instructions are returned as tuple of shifted time and instruction\n         for shift, instruction in schedule.instructions:\n             # TODO: support conditional gate\n-            qobj_instructions.append(instruction_converter(shift, instruction))\n             if isinstance(instruction, PulseInstruction):\n+                name = instruction.command.name\n+                if name in user_pulselib and instruction.command != user_pulselib[name]:\n+                    name = \"{0}-{1:x}\".format(name, hash(instruction.command.samples.tostring()))\n+                    instruction = PulseInstruction(\n+                        command=SamplePulse(name=name, samples=instruction.command.samples),\n+                        name=instruction.name,\n+                        channel=instruction.timeslots.channels[0])\n                 # add samples to pulse library\n-                user_pulselib.add(instruction.command)\n+                user_pulselib[name] = instruction.command\n             if isinstance(instruction, AcquireInstruction):\n                 if meas_map:\n                     # verify all acquires satisfy meas_map\n                     _validate_meas_map(instruction, meas_map)\n+            qobj_instructions.append(instruction_converter(shift, instruction))\n \n         # experiment header\n         qobj_experiment_header = QobjExperimentHeader(\n@@ -77,7 +84,7 @@\n \n     # setup pulse_library\n     qobj_config['pulse_library'] = [PulseLibraryItem(name=pulse.name, samples=pulse.samples)\n-                                    for pulse in user_pulselib]\n+                                    for pulse in user_pulselib.values()]\n \n     # create qobj experiment field\n     experiments = []\n", "issue": "Using multiple SamplePulses with the same name overwritten in Qobj pulse library\n<!-- \u26a0\ufe0f If you do not respect this template, your issue will be closed -->\r\n<!-- \u26a0\ufe0f Make sure to browse the opened and closed issues -->\r\n\r\n### Information\r\n\r\n- **Qiskit Terra version**:\r\n- **Python version**:\r\n- **Operating system**:\r\n\r\n### What is the current behavior?\r\nIn the Qobj specification, pulse are identified by their name. In the pulse module pulses are identified by their object instance and when assembled are stored in the Qobj pulse library by name. If two `SamplePulse`s of the same name exist, the second will overwrite the first, causing undesired behaviour. \r\n\r\n\r\n### Steps to reproduce the problem\r\nCreate a pulse schedule with two different pulses of the same name and assemble into a Qobj.\r\n\r\n\r\n### What is the expected behavior?\r\nUnique pulses should be stored uniquely in the Qobj pulse library.\r\n\r\n\r\n### Suggested solutions\r\nIf a name collision occurs when building the pulse library. Modify the name of the sample pulse in some consistent manner, and adjust the commands that refer to this pulse. \r\n\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017, 2019.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"\"\"Assemble function for converting a list of circuits into a qobj\"\"\"\nfrom qiskit.exceptions import QiskitError\nfrom qiskit.pulse.commands import PulseInstruction, AcquireInstruction\nfrom qiskit.qobj import (PulseQobj, QobjExperimentHeader,\n                         PulseQobjInstruction, PulseQobjExperimentConfig,\n                         PulseQobjExperiment, PulseQobjConfig, PulseLibraryItem)\nfrom qiskit.qobj.converters import InstructionToQobjConverter, LoConfigConverter\n\n\ndef assemble_schedules(schedules, qobj_id, qobj_header, run_config):\n    \"\"\"Assembles a list of schedules into a qobj which can be run on the backend.\n    Args:\n        schedules (list[Schedule]): schedules to assemble\n        qobj_id (int): identifier for the generated qobj\n        qobj_header (QobjHeader): header to pass to the results\n        run_config (RunConfig): configuration of the runtime environment\n    Returns:\n        PulseQobj: the Qobj to be run on the backends\n    Raises:\n        QiskitError: when invalid schedules or configs are provided\n    \"\"\"\n    if hasattr(run_config, 'instruction_converter'):\n        instruction_converter = run_config.instruction_converter\n    else:\n        instruction_converter = InstructionToQobjConverter\n\n    qobj_config = run_config.to_dict()\n    qubit_lo_range = qobj_config.pop('qubit_lo_range')\n    meas_lo_range = qobj_config.pop('meas_lo_range')\n    meas_map = qobj_config.pop('meas_map', None)\n    instruction_converter = instruction_converter(PulseQobjInstruction, **qobj_config)\n\n    lo_converter = LoConfigConverter(PulseQobjExperimentConfig, qubit_lo_range=qubit_lo_range,\n                                     meas_lo_range=meas_lo_range, **qobj_config)\n\n    # Pack everything into the Qobj\n    qobj_schedules = []\n    user_pulselib = set()\n    for idx, schedule in enumerate(schedules):\n        # instructions\n        qobj_instructions = []\n        # Instructions are returned as tuple of shifted time and instruction\n        for shift, instruction in schedule.instructions:\n            # TODO: support conditional gate\n            qobj_instructions.append(instruction_converter(shift, instruction))\n            if isinstance(instruction, PulseInstruction):\n                # add samples to pulse library\n                user_pulselib.add(instruction.command)\n            if isinstance(instruction, AcquireInstruction):\n                if meas_map:\n                    # verify all acquires satisfy meas_map\n                    _validate_meas_map(instruction, meas_map)\n\n        # experiment header\n        qobj_experiment_header = QobjExperimentHeader(\n            name=schedule.name or 'Experiment-%d' % idx\n        )\n\n        qobj_schedules.append({\n            'header': qobj_experiment_header,\n            'instructions': qobj_instructions\n        })\n\n    # setup pulse_library\n    qobj_config['pulse_library'] = [PulseLibraryItem(name=pulse.name, samples=pulse.samples)\n                                    for pulse in user_pulselib]\n\n    # create qobj experiment field\n    experiments = []\n    schedule_los = qobj_config.pop('schedule_los', [])\n\n    if len(schedule_los) == 1:\n        lo_dict = schedule_los[0]\n        # update global config\n        q_los = lo_converter.get_qubit_los(lo_dict)\n        if q_los:\n            qobj_config['qubit_lo_freq'] = q_los\n        m_los = lo_converter.get_meas_los(lo_dict)\n        if m_los:\n            qobj_config['meas_lo_freq'] = m_los\n\n    if schedule_los:\n        # multiple frequency setups\n        if len(qobj_schedules) == 1:\n            # frequency sweep\n            for lo_dict in schedule_los:\n                experiments.append(PulseQobjExperiment(\n                    instructions=qobj_schedules[0]['instructions'],\n                    header=qobj_schedules[0]['header'],\n                    config=lo_converter(lo_dict)\n                ))\n        elif len(qobj_schedules) == len(schedule_los):\n            # n:n setup\n            for lo_dict, schedule in zip(schedule_los, qobj_schedules):\n                experiments.append(PulseQobjExperiment(\n                    instructions=schedule['instructions'],\n                    header=schedule['header'],\n                    config=lo_converter(lo_dict)\n                ))\n        else:\n            raise QiskitError('Invalid LO setting is specified. '\n                              'The LO should be configured for each schedule, or '\n                              'single setup for all schedules (unique), or '\n                              'multiple setups for a single schedule (frequency sweep),'\n                              'or no LO configured at all.')\n    else:\n        # unique frequency setup\n        for schedule in qobj_schedules:\n            experiments.append(PulseQobjExperiment(\n                instructions=schedule['instructions'],\n                header=schedule['header'],\n            ))\n\n    qobj_config = PulseQobjConfig(**qobj_config)\n\n    return PulseQobj(qobj_id=qobj_id,\n                     config=qobj_config,\n                     experiments=experiments,\n                     header=qobj_header)\n\n\ndef _validate_meas_map(acquire, meas_map):\n    \"\"\"Validate all qubits tied in meas_map are to be acquired.\"\"\"\n    meas_map_set = [set(m) for m in meas_map]\n    # Verify that each qubit is listed once in measurement map\n    measured_qubits = {acq_ch.index for acq_ch in acquire.acquires}\n    tied_qubits = set()\n    for meas_qubit in measured_qubits:\n        for map_inst in meas_map_set:\n            if meas_qubit in map_inst:\n                tied_qubits |= map_inst\n\n    if measured_qubits != tied_qubits:\n        raise QiskitError('Qubits to be acquired: {0} do not satisfy required qubits '\n                          'in measurement map: {1}'.format(measured_qubits, tied_qubits))\n    return True\n", "path": "qiskit/assembler/assemble_schedules.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017, 2019.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"\"\"Assemble function for converting a list of circuits into a qobj\"\"\"\nfrom qiskit.exceptions import QiskitError\nfrom qiskit.pulse.commands import PulseInstruction, AcquireInstruction, SamplePulse\nfrom qiskit.qobj import (PulseQobj, QobjExperimentHeader,\n                         PulseQobjInstruction, PulseQobjExperimentConfig,\n                         PulseQobjExperiment, PulseQobjConfig, PulseLibraryItem)\nfrom qiskit.qobj.converters import InstructionToQobjConverter, LoConfigConverter\n\n\ndef assemble_schedules(schedules, qobj_id, qobj_header, run_config):\n    \"\"\"Assembles a list of schedules into a qobj which can be run on the backend.\n    Args:\n        schedules (list[Schedule]): schedules to assemble\n        qobj_id (int): identifier for the generated qobj\n        qobj_header (QobjHeader): header to pass to the results\n        run_config (RunConfig): configuration of the runtime environment\n    Returns:\n        PulseQobj: the Qobj to be run on the backends\n    Raises:\n        QiskitError: when invalid schedules or configs are provided\n    \"\"\"\n    if hasattr(run_config, 'instruction_converter'):\n        instruction_converter = run_config.instruction_converter\n    else:\n        instruction_converter = InstructionToQobjConverter\n\n    qobj_config = run_config.to_dict()\n    qubit_lo_range = qobj_config.pop('qubit_lo_range')\n    meas_lo_range = qobj_config.pop('meas_lo_range')\n    meas_map = qobj_config.pop('meas_map', None)\n    instruction_converter = instruction_converter(PulseQobjInstruction, **qobj_config)\n\n    lo_converter = LoConfigConverter(PulseQobjExperimentConfig, qubit_lo_range=qubit_lo_range,\n                                     meas_lo_range=meas_lo_range, **qobj_config)\n\n    # Pack everything into the Qobj\n    qobj_schedules = []\n    user_pulselib = {}\n    for idx, schedule in enumerate(schedules):\n        # instructions\n        qobj_instructions = []\n        # Instructions are returned as tuple of shifted time and instruction\n        for shift, instruction in schedule.instructions:\n            # TODO: support conditional gate\n            if isinstance(instruction, PulseInstruction):\n                name = instruction.command.name\n                if name in user_pulselib and instruction.command != user_pulselib[name]:\n                    name = \"{0}-{1:x}\".format(name, hash(instruction.command.samples.tostring()))\n                    instruction = PulseInstruction(\n                        command=SamplePulse(name=name, samples=instruction.command.samples),\n                        name=instruction.name,\n                        channel=instruction.timeslots.channels[0])\n                # add samples to pulse library\n                user_pulselib[name] = instruction.command\n            if isinstance(instruction, AcquireInstruction):\n                if meas_map:\n                    # verify all acquires satisfy meas_map\n                    _validate_meas_map(instruction, meas_map)\n            qobj_instructions.append(instruction_converter(shift, instruction))\n\n        # experiment header\n        qobj_experiment_header = QobjExperimentHeader(\n            name=schedule.name or 'Experiment-%d' % idx\n        )\n\n        qobj_schedules.append({\n            'header': qobj_experiment_header,\n            'instructions': qobj_instructions\n        })\n\n    # setup pulse_library\n    qobj_config['pulse_library'] = [PulseLibraryItem(name=pulse.name, samples=pulse.samples)\n                                    for pulse in user_pulselib.values()]\n\n    # create qobj experiment field\n    experiments = []\n    schedule_los = qobj_config.pop('schedule_los', [])\n\n    if len(schedule_los) == 1:\n        lo_dict = schedule_los[0]\n        # update global config\n        q_los = lo_converter.get_qubit_los(lo_dict)\n        if q_los:\n            qobj_config['qubit_lo_freq'] = q_los\n        m_los = lo_converter.get_meas_los(lo_dict)\n        if m_los:\n            qobj_config['meas_lo_freq'] = m_los\n\n    if schedule_los:\n        # multiple frequency setups\n        if len(qobj_schedules) == 1:\n            # frequency sweep\n            for lo_dict in schedule_los:\n                experiments.append(PulseQobjExperiment(\n                    instructions=qobj_schedules[0]['instructions'],\n                    header=qobj_schedules[0]['header'],\n                    config=lo_converter(lo_dict)\n                ))\n        elif len(qobj_schedules) == len(schedule_los):\n            # n:n setup\n            for lo_dict, schedule in zip(schedule_los, qobj_schedules):\n                experiments.append(PulseQobjExperiment(\n                    instructions=schedule['instructions'],\n                    header=schedule['header'],\n                    config=lo_converter(lo_dict)\n                ))\n        else:\n            raise QiskitError('Invalid LO setting is specified. '\n                              'The LO should be configured for each schedule, or '\n                              'single setup for all schedules (unique), or '\n                              'multiple setups for a single schedule (frequency sweep),'\n                              'or no LO configured at all.')\n    else:\n        # unique frequency setup\n        for schedule in qobj_schedules:\n            experiments.append(PulseQobjExperiment(\n                instructions=schedule['instructions'],\n                header=schedule['header'],\n            ))\n\n    qobj_config = PulseQobjConfig(**qobj_config)\n\n    return PulseQobj(qobj_id=qobj_id,\n                     config=qobj_config,\n                     experiments=experiments,\n                     header=qobj_header)\n\n\ndef _validate_meas_map(acquire, meas_map):\n    \"\"\"Validate all qubits tied in meas_map are to be acquired.\"\"\"\n    meas_map_set = [set(m) for m in meas_map]\n    # Verify that each qubit is listed once in measurement map\n    measured_qubits = {acq_ch.index for acq_ch in acquire.acquires}\n    tied_qubits = set()\n    for meas_qubit in measured_qubits:\n        for map_inst in meas_map_set:\n            if meas_qubit in map_inst:\n                tied_qubits |= map_inst\n\n    if measured_qubits != tied_qubits:\n        raise QiskitError('Qubits to be acquired: {0} do not satisfy required qubits '\n                          'in measurement map: {1}'.format(measured_qubits, tied_qubits))\n    return True\n", "path": "qiskit/assembler/assemble_schedules.py"}]}