# Managing Calibration Data: Step-by-Step Guide

## Create Branch&#x20;

Let's start with creating the Branch.

{% tabs %}
{% tab title="Web Platform " %}

<figure><img src="https://1520191383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh5zvbKTgSzwf8hLhGaTM%2Fuploads%2FTuEhzNADW0xQCO7Pc5uH%2FScreenshot%202023-11-15%20at%203.15.16%E2%80%AFPM.png?alt=media&#x26;token=b8b12cf2-a6f6-4848-b11d-ea78083ef839" alt="" width="563"><figcaption><p>Create New Branch</p></figcaption></figure>
{% endtab %}

{% tab title="Jupyter NoteBook" %}

<pre class="language-python" data-title="Create Branch" data-line-numbers data-full-width="true"><code class="lang-python"><strong>from qubicstorage import calibration
</strong>import json
commit_data = {
    'author_name': 'John Doe',
    'author_email': 'john@example.com',
    'author_message': 'Initial commit'
}
branch_name = 'test_branch'
response = calibration.createbranch(commit_data, branch_name)
response_json_content = response.json()
response_json_string = json.dumps(response_json_content, indent=4)
print(response_json_string)
</code></pre>

{% endtab %}
{% endtabs %}

## Add Chip&#x20;

Add a chip to the selected Branch.

{% tabs %}
{% tab title="Web Platform" %}

<figure><img src="https://1520191383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh5zvbKTgSzwf8hLhGaTM%2Fuploads%2FNcovbmKvxU0u5SWh70cU%2FScreenshot%202023-11-15%20at%203.12.46%E2%80%AFPM.png?alt=media&#x26;token=6bb109c8-ef02-4a7c-8567-677115a2e63b" alt="" width="375"><figcaption><p>Add New chip</p></figcaption></figure>
{% endtab %}

{% tab title="Jupyter NoteBook" %}
{% code title="Add Chip to Branch" lineNumbers="true" %}

````python
from qubicstorage import calibration
import json
chip_data = {
    'name': 'X4Y2',
}
branch_name = 'test'
response = calibration.insertchip(chip_data, branch_name)
response_json_content = response.json()
response_json_string = json.dumps(response_json_content, indent=4)
print(response_json_string)
```
````

{% endcode %}
{% endtab %}
{% endtabs %}

## Web Platform: Commit Calibration Data

Steps:&#x20;

1. Select the Chip for which you are uploading the calibration data from the drop-down
2. Upload the JSON file only after selecting the Chip from the drop-down. (Only for Web Platform)
3. Write a Commit Details.
4. View the Committed Data

{% tabs %}
{% tab title="Step 1" %}

<figure><img src="https://1520191383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh5zvbKTgSzwf8hLhGaTM%2Fuploads%2FrPOj5rwpeYB1jFJKONR0%2FScreenshot%202023-11-15%20at%203.29.04%E2%80%AFPM.png?alt=media&#x26;token=d21ab05d-8801-45c9-a715-fb14e67c6a6c" alt=""><figcaption><p>Select Chip from options</p></figcaption></figure>
{% endtab %}

{% tab title="Step 2" %}

<figure><img src="https://1520191383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh5zvbKTgSzwf8hLhGaTM%2Fuploads%2FlWqwgFw6y5Qtx01QMnG8%2FScreenshot%202023-11-15%20at%203.29.34%E2%80%AFPM.png?alt=media&#x26;token=629bcd46-97c3-45b6-9870-fe64c4afcf1f" alt="" width="563"><figcaption><p>Upload Calibration File</p></figcaption></figure>
{% endtab %}

{% tab title="Step 3" %}

<figure><img src="https://1520191383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh5zvbKTgSzwf8hLhGaTM%2Fuploads%2FeJgPBKY0yPQE7rCOajSM%2FScreenshot%202023-11-15%20at%203.30.23%E2%80%AFPM.png?alt=media&#x26;token=82a020e9-5a0a-4ac5-8398-6aea75876723" alt=""><figcaption><p>Add Commit Details</p></figcaption></figure>
{% endtab %}

{% tab title="Step 4" %}

<figure><img src="https://1520191383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh5zvbKTgSzwf8hLhGaTM%2Fuploads%2FDAerUOyMj43ZnHL27lRV%2FScreenshot%202023-11-15%20at%203.33.20%E2%80%AFPM.png?alt=media&#x26;token=46c9e27c-f69f-42c2-a505-370637828840" alt=""><figcaption><p>View Latest Committed Data</p></figcaption></figure>
{% endtab %}
{% endtabs %}

## Jupyter NoteBook: Commit Calibration Data&#x20;

Steps:&#x20;

1. Get all the Branch Details.
2. For the selected Branch Get all the Chip Details
3. Specify Branch, Chip\_ID, and Commit Data to upload Calibration File or Object.
4. View Committed Data
   1. Get the Branch Details and select a specific commit hash
   2. Specified commit hash and view the data

{% tabs %}
{% tab title="Step 1" %}
{% code title="List of Branch available" lineNumbers="true" %}

```python
from qubicstorage import calibration
import json

response = calibration.getbranches()
response_json_content = response.json()
response_json_string = json.dumps(response_json_content, indent=4)
print(response_json_string)
```

{% endcode %}
{% endtab %}

{% tab title="Step 2" %}
{% code title="List of all Chips" lineNumbers="true" %}

```python
# Get chip Id 
from qubicstorage import calibration
import json
branch_name = 'test_de'
response = calibration.getchips(branch_name)
response_json_content = response.json()
response_json_string = json.dumps(response_json_content, indent=4)
print(response_json_string)
```

{% endcode %}
{% endtab %}

{% tab title="Step 3 (File)" %}
{% code title="Commit Calibration File" lineNumbers="true" %}

```python
from qubicstorage import calibration
file_path = 'qubitcfg.json'
commit_data = {
    'author_name': 'John Doe',
    'author_email': 'john@example.com',
    'message': 'Initial commit'
}
branch_name = 'test_de'
chip_id ='4' // Get Chip_id from previous step
        
response = calibration.insertbyfile(file_path, commit_data, branch_name,chip_id)
print(response)
```

{% endcode %}
{% endtab %}

{% tab title="Step 3 (Object)" %}
{% code title="Commit as JSON" lineNumbers="true" %}

```python
from qubicstorage import calibration
json_data = {....}
commit_data = {
    'author_name': 'Dev Doe',
    'author_email': 'john@example.com',
    'message': 'Initial commit'
}
branch_name = 'main'
chip_id ='1'
response = calibration.insertbyobject(json_data, commit_data, branch_name,chip_id)
```

{% endcode %}
{% endtab %}

{% tab title="Step 4.1" %}
{% code title="Details to select Hash" lineNumbers="true" %}

```python
# Get Branch Details
from qubicstorage import calibration
import json
branch_name = 'main'

response = calibration.getbranchdetails(branch_name)
response_json_content = response.json()
response_json_string = json.dumps(response_json_content, indent=4)
print(response_json_string)
```

{% endcode %}
{% endtab %}

{% tab title="Step 4.2" %}
{% code title="Committed Data" lineNumbers="true" %}

```python
# Get Specific Commit Details
from qubicstorage import calibration
import json
hash = 'g4690gfr130m6rqbgl0927s07gfkntg6'
response = calibration.getcommitdetails(hash)
response_json_content = response.json()
response_json_string = json.dumps(response_json_content, indent=4)
print(response_json_string)
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devanshus-organization.gitbook.io/qubic-docs/managing-calibration-data-step-by-step-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
