{% from "_roughness_help.html" import roughness_help %} {% from "_afm_help.html" import afm_help %} {% extends "base.html" %} {% from "_geometry_view.html" import geometry_view %} {% block title %}New grating{% endblock %} {% block body %}

New grating

Etched grating profiles with optional coating layers

{# The type choice stays at the top: the AFM import below is very tall and would push it out of reach. #}
{% set type_picker_on_top = true %}

Import AFM profile

Upload a two-column x/z scan and preprocess one period before using it as a profile grating.

Accepted formats: .csv, .tsv, .txt, and .dat. Use a text file with two numeric columns (x and z), separated by commas, tabs, semicolons, or spaces. A header row is optional.

{% if existing_afm_source_url %}

Stored AFM scan: {{ defaults.afm_source_filename or 'Download scan' }}. Choose a new file to replace it.

{% endif %}
{% if existing_afm_source_url %}{% endif %}

The AFM analysis uses the period from the Profile section below.

{{ afm_help('process', 'process AFM profile') }}
{% if return_to_run %}{% endif %} {% if form_error %}{% endif %} {% for material in materials %} {% endfor %} {% include "_grating_fields.html" %} {% include "_substrate_fields.html" %} {% set substrate_rendered = true %} {% include "_stack_fields.html" %}
{# One status: a pill (Idle, Waiting, Rendering, Ready, Invalid, Error) and an optional message. #} {% set preview_invalid = preview and not preview.ok %} {% set preview_message = (preview.error or "") if preview_invalid else "" %}

Live preview

Status: {{ "Invalid" if preview_invalid else "Idle" }} {{ preview_message }}

{{ geometry_view("grating", bind="[data-afm-process-form], [data-grating-preview-form]", nominal=defaults.grating_type) }} {% if preview and preview.preview_url %} Live grating preview {% else %} {% endif %} {# Same status as in the heading above, kept in step by initGratingPreview. #}

Status: {{ "Invalid" if preview_invalid else "Idle" }} {{ preview_message }}

{{ (preview.warnings|default([]))|join(' ') if preview else '' }}

Random roughness interfaces and material map
{% endblock %}