Place the flour and butter in a food processor and pulse.
Add the icing sugar, egg yolk and vanilla essence (or extract) and pulse again. If the dough is too dry add the egg white and pulse again.
Wrap in cling film and chill for a minimum of 30 minutes before rolling out.
Roll out in a circle to a thickness of about 3 mm. Line a 20cm diameter non stick loose bottomed flan dish, gently press into position and trim any excess pastry.
To prepare the frangipane filling
Place the pistachios (without shells) in a food processor and chop until almost a powder.
Cream the butter and sugar together in a large bowl.
Add the egg, chopped pistachios and almond essence and beat with a wooden spoon.
To assemble
Spread the frangipane evenly over the base of the pastry case.
Arrange the raspberries or cherry halves over the frangipane filling.
To bake
Preheat the oven to 180°C, 350°F, gas mark 4.
Bake in the centre of the oven for about 30 minutes or until the frangipane is firm and slightly golden.
Leave to cool in the tin on a wire rack and then carefully remove and place on a serving plate.