Beispiel #1
0
static GwyContainer*
apefile_get_metadata(APEFile *apefile)
{
    GwyContainer *meta;
    gchar *p;

    meta = gwy_container_new();

    HASH_STORE("Version", "%u", version);
    HASH_STORE("Tip oscilation frequency", "%g Hz", freq_osc_tip);
    HASH_STORE("Acquire delay", "%.6f s", acquire_delay);
    HASH_STORE("Raster delay", "%.6f s", raster_delay);
    HASH_STORE("Tip distance", "%g nm", tip_dist);

    if (apefile->remark && *apefile->remark
        && (p = g_convert(apefile->remark, strlen(apefile->remark),
                          "UTF-8", "ISO-8859-1", NULL, NULL, NULL)))
        gwy_container_set_string_by_name(meta, "Comment", p);
    gwy_container_set_string_by_name
                    (meta, "SPM mode",
                     g_strdup(gwy_enum_to_string(apefile->spm_mode, spm_modes,
                                                 G_N_ELEMENTS(spm_modes))));
    p = format_vt_date(apefile->scan_date);
    if (p)
        gwy_container_set_string_by_name(meta, "Date", p);

    return meta;
}
Beispiel #2
0
static GwyContainer*
apefile_get_metadata(APEFile *apefile)
{
    GwyContainer *meta;
    gchar *p;

    meta = gwy_container_new();

    gwy_container_set_string_by_name(meta, "Version",
                                     g_strdup_printf("%u.%u", apefile->version,
                                                     apefile->subversion));

    /*
     * In SPM_MODE_SNOM or SPM_MODE_AFM_NONCONTACT freq_osc_tip holds the tip
     * oscillation frequency.
     * If spm_mode=SPM_MODE_AFM_CONTACT then the freq_osc_tip field holds the
     * force the tip applies to the sample in nN.
     * If spm_mode=SPM_MODE_STM then freq_osc_tip holds the bias voltage in
     * Volts.
     */
    switch (apefile->spm_mode) {
        case SPM_MODE_SNOM:
        case SPM_MODE_AFM_NONCONTACT:
            HASH_STORE("Tip oscillation frequency", "%g Hz", freq_osc_tip);
            break;
        case SPM_MODE_AFM_CONTACT:
            HASH_STORE("Force", "%g nN", freq_osc_tip);
            break;
        case SPM_MODE_STM:
            HASH_STORE("Bias", "%g V", freq_osc_tip);
            break;
        default:
            HASH_STORE("Tip oscillation frequency", "%g Hz", freq_osc_tip);
            break;
    }

    /* We will fetch the HV Amplifier status only if file version>= 2.4*/
    if (apefile->version > 1 && apefile->subversion >= 4) {
        gwy_container_set_string_by_name
            (meta, "XY HV Status",
             g_strdup(gwy_enum_to_string(apefile->xy_hv_status, hva_statuses,
                                         G_N_ELEMENTS(hva_statuses))));
        gwy_container_set_string_by_name
            (meta, "Z HV Status",
             g_strdup(gwy_enum_to_string(apefile->z_hv_status, hva_statuses,
                                         G_N_ELEMENTS(hva_statuses))));
    }

    HASH_STORE("Acquire delay", "%.6f s", acquire_delay);
    HASH_STORE("Raster delay", "%.6f s", raster_delay);
    HASH_STORE("Tip distance", "%g nm", tip_dist);

    if (apefile->remark && *apefile->remark
        && (p = g_convert(apefile->remark, strlen(apefile->remark),
                          "UTF-8", "ISO-8859-1", NULL, NULL, NULL)))
        gwy_container_set_string_by_name(meta, "Comment", p);
    gwy_container_set_string_by_name
                    (meta, "SPM mode",
                     g_strdup(gwy_enum_to_string(apefile->spm_mode, spm_modes,
                                                 G_N_ELEMENTS(spm_modes))));
    p = format_vt_date(apefile->scan_date);
    if (p)
        gwy_container_set_string_by_name(meta, "Date", p);

    return meta;
}