SOM1.setAllAxisUnits(["1/A"]) SOM1.attr_list["data-title"] = "Test File" SOM1.attr_list["data-run_number"] = "1344" DSample = Sample() DSample.name = "Test Sample" DSample.nature = "K3NO+" SOM1.attr_list.sample = DSample DInst = Instrument(instrument="SANS", primary=(15.0,0.0), det_secondary=(2.0,0.0), x_pix_offset=[(), (), ]) SOM1.attr_list.instrument = DInst length = 10 SO1 = SO(construct=True, withXVar=True) for i in range(length): SO1.axis[0].val.append(float(i)) SO1.y.append(float(100*i)) SO1.var_y.append(float(100*i)) SO1.axis[0].val.append(length) SOM1.append(SO1) ifile = open("test_cansas1d.xml", "w") cs1d = DST.CanSas1dDST(ifile) cs1d.writeSOM(SOM1) cs1d.release_resource()
filename_SOM1 = "stuff1.dat" SOM1 = SOM() SOM1.attr_list["filename"] = filename_SOM1 SOM1.attr_list["epoch"] = time() SOM1.attr_list["timestamp"] = DST.make_ISO8601(SOM1.attr_list["epoch"]) SOM1.attr_list["username"] = "******" SOM1.setAllAxisLabels(["Q", "E"]) SOM1.setAllAxisUnits(["A-1", "meV"]) SOM1.setYLabel("Intensity") SOM1.setYUnits("Counts/(meV A-1))") SO1 = SO(2) SO1.id = 0 SO1.axis[0].val.extend(range(5)) SO1.axis[1].val.extend(range(10)) y_len = (len(SO1.axis[0].val) - 1) * (len(SO1.axis[1].val) - 1) y = range(y_len) SO1.y.extend(y) SO1.var_y.extend(y) SOM1.append(SO1) file = open(filename_SOM1, "w") d2d = DST.Dave2dDST(file) d2d.writeSOM(SOM1) d2d.release_resource()
SO1.id = i SO1.axis[0].val.append(j+1) if options.withXvar: SO1.axis[0].var.append(j+1) SO1.y.append(1000+j+(20*j)) SO1.var_y.append(100+j) if options.extraSom: SO2.id = i SO2.axis[0].val.append((j+1)*1.0579838) SO2.y.append(1000+j+(20*j)) SO2.var_y.append(100+j) SO1.axis[0].val.append(11) if options.withXvar: SO1.axis[0].var.append(11) if options.extraSom: SO2.axis[0].val.append(11*1.0579838) SOM1.append(SO1) if options.extraSom: SOM2.append(SO2) file = open(filename_SOM1, "w") a3c = DST.Ascii3ColDST(file) a3c.writeSOM(SOM1, extra_som=SOM2) a3c.release_resource()