Die analysis

Now we will run a sheet resistance analysis using the device analyses we triggered in the device analysis notebook. Make sure all the analyses we triggered are finished (i.e. make sure the last cell in that notebook has finished running)!

As before, make sure you have the following environment variables set or added to a .env file:

GDSFACTORY_HUB_API_URL="https://{org}.gdsfactoryhub.com"
GDSFACTORY_HUB_QUERY_URL="https://query.{org}.gdsfactoryhub.com"
GDSFACTORY_HUB_KEY="<your-gdsfactoryplus-api-key>"
import getpass

from tqdm.auto import tqdm

import gdsfactoryhub as gfh
project_id = f"resistance-{getpass.getuser()}"
client = gfh.create_client_from_env(project_id=project_id)
api = client.api()
query = client.query()
utils = client.utils()

Die Analysis

from gdsfactoryhub.functions.die import iv_sheet_resistance

iv_sheet_resistance.run?
die_pkey = query.dies().limit(1).execute().data[0]["pk"]
iv_sheet_resistance.run(die_pkey, width_key="width_um", length_key="length_um")
{'output': {'sheet_resistance': 97.34212154102445},
 'summary_plot': <Figure size 640x480 with 1 Axes>,
 'die_pkey': 'ee8b77d0-6488-413a-a0d9-80dc6cae6cf0'}

png

Just like before we can run the analysis function remotely to see if it runs there too. It might even be faster than the local run, because the server is closer to the database.

We can upload this analysis function:

with gfh.suppress_api_error():
    result = api.upload_function(
        function_id="die_iv_sheet_resistance",
        target_model="die",
        file=gfh.get_module_path(iv_sheet_resistance),
        test_target_model_pk=die_pkey,
        test_kwargs={
            "width_key": "width_um",
            "length_key": "length_um",
        },
    )
Duplicate function

Let's start all the analyses:

die_pks = [d["pk"] for d in query.dies().execute().data]
results = []
for die_pk in (pb := tqdm(die_pks)):
    pb.set_postfix(die_pk=die_pk)
    result = api.start_analysis(
        analysis_id=f"die_iv_sheet_resistance_{die_pk}",
        function_id="die_iv_sheet_resistance",
        target_model="die",
        target_model_pk=die_pk,
        kwargs={
            "width_key": "width_um",
            "length_key": "length_um",
        },
    )
    results.append(result)
  0%|          | 0/63 [00:00<?, ?it/s]

Let's have a look at the last analysis:

analysis_pks = [r["pk"] for r in results]
utils.analyses().wait_for_completion(pks=analysis_pks)
analyses = query.analyses().in_("pk", analysis_pks).execute().data
succesful_analyses = [a for a in analyses if a["status"] == "COMPLETED"]
analysis = succesful_analyses[-1]
img = api.download_plot(analysis["summary_plot"]["path"])
img.resize((530, 400))
Waiting for analyses:   0%|          | 0/63 [00:00<?, ?it/s]

png

On This Page