The rotation is not applied when converting the region from world to physical coordinates. In this case, region filters should be written only in terms of physical coordinates (i.e. SKY pixels).
For example, setting xmax > xmin and/or ymax > ymin. Instead it appears that the Data Model simply swaps the min and max values.
unix% dmcopy evt.fits[sky=region(complex.reg)][bin sky=1] out.fits unix% dmstat out.fits[sky=region(complex.reg)] cen-
This is due to the fact that the regions applied in the dmcopy are recorded in the file subspace, and the subsequent tool - dmstat in this case - does not combine them with the second (identical) filter correctly. Other tools that take the subspace into account will exhibit this problem as well.
The example does work for simple regions, e.g. "circle(4096,4096,10)", but the workarounds can still be applied.
Use "[opt update=no]" in the dmcopy step so that the filter does not get recorded in the subspace. Be aware, however, that this means you lose information on what filters have been applied to the data.
omit the DM filter from the second infile name.
unix% dmcopy "input.fits[sky=circle(4096,4096,100),y=4020:4100,4250,4350]" \ output.fits
fails to do the y filter altogether. This bug also applies to exclude filters.
Compare the output of these two commands:
% dmstat "file.fits[sky=pie(03:19:48.390,+41:30:41.42,8.5',9',350,366)]" centroid=no EVENTS_IMAGE min: 1 @: ( 4759 3089 ) max: 1 @: ( 4759 3089 ) mean: 1 sum: 4538 good: 4538 null: 1202164 % dmstat "file.fits[sky=pie(03:19:48.390,+41:30:41.42,8.5',9',100,116)]" centroid=no EVENTS_IMAGE min: 1 @: ( 3233 4211 ) max: 1 @: ( 3233 4211 ) mean: 1 sum: 4538 good: 4538 null: 7014
When computing the bounds of the 350:366 pie, the modulo 360 is not correctly taken into account.
Modify the pie region by 360 degrees manually before running the command:
% dmstat "file.fits[sky=pie(03:19:48.390,+41:30:41.42,8.5',9',350,6)]" centroid=no EVENTS_IMAGE min: 1 @: ( 4759 3089 ) max: 1 @: ( 4759 3089 ) mean: 1 sum: 4538 good: 4538 null: 1622