@@ -150,12 +150,12 @@ class CIFSchema:
150150CORE_SCHEMA = CIFSchema (
151151 name = 'coreCIF' ,
152152 version = '3.3.0' ,
153- location = 'https://github.com/COMCIFS/cif_core/blob/fc3d75a298fd7c0c3cde43633f2a8616e826bfd5 /cif_core.dic' ,
153+ location = 'https://github.com/COMCIFS/cif_core/blob/6f8502e81b623eb0fd779c79efaf191d49fa198c /cif_core.dic' ,
154154)
155155PD_SCHEMA = CIFSchema (
156156 name = 'pdCIF' ,
157157 version = '2.5.0' ,
158- location = 'https://github.com/COMCIFS/Powder_Dictionary/blob/7608b92165f58f968f054344e67662e01d4b401a /cif_pow.dic' ,
158+ location = 'https://github.com/COMCIFS/Powder_Dictionary/blob/970c2b2850a923796db5f4e9b7207d10ab5fd8e5 /cif_pow.dic' ,
159159)
160160
161161
@@ -298,7 +298,9 @@ def with_reduced_powder_data(self, data: sc.DataArray, *, comment: str = '') ->
298298 ``('tof', 'dspacing')``.
299299 The data array may also have a name in
300300 ``('intensity_net', 'intensity_norm', 'intensity_total')``.
301- If the name is not set, it defaults to ``'intensity_net'``.
301+ If the name is not set, it defaults to ``'intensity_norm'``,
302+ which is appropriate for typical outputs from data reduction.
303+ See https://github.com/COMCIFS/Powder_Dictionary/blob/master/cif_pow.dic
302304
303305 The data gets written as intensity along a single coord whose
304306 name matches the dimension name.
@@ -884,9 +886,16 @@ def _normalize_reduced_powder_name(name: str) -> str:
884886
885887def _make_reduced_powder_loop (data : sc .DataArray , comment : str ) -> Loop :
886888 coord_name , coord = _reduced_powder_coord (data )
887- data_name = _normalize_reduced_powder_name (data .name or 'intensity_net ' )
889+ data_name = _normalize_reduced_powder_name (data .name or 'intensity_norm ' )
888890
889- res = Loop ({coord_name : sc .values (coord )}, comment = comment , schema = PD_SCHEMA )
891+ res = Loop (
892+ {
893+ 'pd_data.point_id' : sc .arange (data .dim , len (data ), unit = None ),
894+ coord_name : sc .values (coord ),
895+ },
896+ comment = comment ,
897+ schema = PD_SCHEMA ,
898+ )
890899 if coord .variances is not None :
891900 res [coord_name + '_su' ] = sc .stddevs (coord )
892901 res [data_name ] = sc .values (data .data )
@@ -901,11 +910,13 @@ def _make_reduced_powder_loop(data: sc.DataArray, comment: str) -> Loop:
901910
902911
903912def _make_powder_calibration_loop (data : sc .DataArray , comment : str ) -> Loop :
904- id_by_power = {0 : 'tzero' , 1 : 'DIFC' , 2 : 'DIFA' , - 1 : 'DIFB' }
913+ # All names are valid python identifiers
914+ id_by_power = {0 : 'ZERO' , 1 : 'DIFC' , 2 : 'DIFA' , - 1 : 'DIFB' }
905915 ids = sc .array (
906916 dims = [data .dim ],
907917 values = [
908- id_by_power .get (power , str (power )) for power in data .coords ['power' ].values
918+ id_by_power .get (power , f'c{ power } ' .replace ('-' , '_' ).replace ('.' , '_' ))
919+ for power in data .coords ['power' ].values
909920 ],
910921 )
911922 res = Loop (
0 commit comments