Alright, I'll try to clarify my post earlier since after rereading it I didn't feel it was clear enough.
Scorching Ray
School evocation [fire]; Level sorcerer/wizard 2
Casting Time 1 standard action
Components V, S
Range close (25 ft. + 5 ft./2 levels)
Effect one or more rays
Duration instantaneous
Saving Throw none; Spell Resistance yes
You blast your enemies with a searing beam of fire. You may fire one ray, plus one additional ray for every four levels beyond 3rd (to a maximum of three rays at 11th level). Each ray requires a ranged touch attack to hit and deals 4d6 points of fire damage. The rays may be fired at the same or different targets, but all rays must be aimed at targets within 30 feet of each other and fired simultaneously.
Ray of Frost
School evocation [cold]; Level sorcerer/wizard 0
Casting Time 1 standard action
Components V, S
Range close (25 ft. + 5 ft./2 levels)
Effect ray
Duration instantaneous
Saving Throw none; Spell Resistance yes
A ray of freezing air and ice projects from your pointing finger. You must succeed on a ranged touch attack with the ray to deal damage to a target. The ray deals 1d3 points of cold damage.
Polar Ray
School evocation [cold]; Level sorcerer/wizard 8
Casting Time 1 standard action
Components V, S, F (a white ceramic cone or prism)
Range medium (100 ft. + 10 ft./level)
Effect ray
Duration instantaneous
Saving Throw none; Spell Resistance yes
A blue-white ray of freezing air and ice springs from your hand. You must succeed on a ranged touch attack with the ray to deal damage to a target. The ray deals 1d6 points of cold damage per caster level (maximum 25d6) and 1d4 points of Dexterity drain.
Since they have an instantaneous duration the rays have to be fired in the round they are created in. In all of the spells that create rays, it specifically says in the spell description that as part of the spell you make an attack roll. The attack roll is part of the spell itself, which is why Weapon Focus [ray] is specifically mentioned in the description of spell perfection. The bonus to the attack roll is applied to spell because the attack roll is part of the spell, and therefore it is doubled.
Shadow Weapon
School illusion (shadow) [shadow]; Level sorcerer/wizard 1, witch 1
Casting Time 1 standard action
Components V, S
Range 0 ft.
Effect one shadow weapon
Duration 1 minute/level
Saving Throw Will disbelief (if interacted with); Spell Resistance yes
Drawing upon the Plane of Shadow, you shape a quasi-real masterwork melee weapon of a type you are proficient with. You may use this weapon to make attacks as if it were a real weapon, dealing normal damage for a weapon of its type. The first time you hit a creature with the weapon, it may make a Will save to disbelieve; failure means the weapon deals damage normally, success means it only takes 1 point of damage from the weapon's attacks. The weapon only deals 1 point of damage to objects.
If an attacked creature has spell resistance, you make a caster level check (1d20 + caster level) against that spell resistance the first time the shadow weapon strikes it. If the weapon is successfully resisted, the spell is dispelled. If not, the target may save to disbelieve as normal.
At 5th level, the weapon gains a +1 enhancement bonus. At 10th-level, you may increase the enhancement bonus to +2 or add the frost or keen weapon property. The frost and keen properties have no effect if the target makes its disbelief save.
The spell ends if the weapon leaves your possession.
The Shadow Weapon spell itself just creates the weapon in your hand. The weapon is the effect of the spell, not the spell itself. It has an ongoing effect, rather than an instantaneous one so it stays in your hand for 1 minute per caster level. Nowhere in the effect or the description of the spell does it say that you make an attack roll as part of the spell.
Power Attack (general)
You can make exceptionally deadly melee attacks by sacrificing accuracy for strength.
Prerequisites: Str 13, base attack bonus +1.
Benefit: You can choose to take a –1 penalty on all melee attack rolls and combat maneuver checks to gain a +2 bonus on all melee damage rolls. This bonus to damage is increased by half (+50%) if you are making an attack with a two-handed weapon, a one handed weapon using two hands, or a primary natural weapon that adds 1-1/2 times your Strength modifier on damage rolls. This bonus to damage is halved (–50%) if you are making an attack with an off-hand weapon or secondary natural weapon. When your base attack bonus reaches +4, and every 4 points thereafter, the penalty increases by –1 and the bonus to damage increases by +2. You must choose to use this feat before making an attack roll, and its effects last until your next turn. The bonus damage does not apply to touch attacks or effects that do not deal hit point damage.
Power Attack specifically states that the feat modifies melee attack rolls, it does not state anything about modifying the weapon/item/spell effect.
Spell Perfection
You are unequaled at the casting of one particular spell.
Prerequisites: Spellcraft 15 ranks, at least three metamagic feats.
Benefit: Pick one spell which you have the ability to cast. Whenever you cast that spell you may apply any one metamagic feat you have to that spell without affecting its level or casting time, as long as the total modified level of the spell does not use a spell slot above 9th level. In addition, if you have other feats which allow you to apply a set numerical bonus to any aspect of this spell (such as Spell Focus, Spell Penetration, Weapon Focus [ray], and so on), double the bonus granted by that feat when applied to this spell.
Spell Perfection clearly states that the bonus from any feats that apply a numerical bonus to any aspect of this spell you can double the bonus granted by the feat.
Weapon Focus [ray] applies to the spell, because the attack roll is part of the spell when you use a ray. The attack roll is described in the description of the spell.
Weapon Focus
Choose one type of weapon. You can also choose unarmed strike or grapple (or ray, if you are a spellcaster) as your weapon for the purposes of this feat.
Prerequisites: Proficiency with selected weapon, base attack bonus +1.
Benefit: You gain a +1 bonus on all attack rolls you make using the selected weapon.
Special: You can gain this feat multiple times. Its effects do not stack. Each time you take the feat, it applies to a new type of weapon.
Weapon Focus states that it grants a bonus to the attack roll made with the selected weapon. It can be used with spells Flame Blade because the description of Flame Blade states that you wield it as if it were a scimitar. So Weapon Focus [scimitar] would apply a +1 to the attack roll. It isn't effecting the spell itself, it is effecting your melee attack roll. The only mention of an attack roll in Flame Blade's description is that it makes your attack rolls melee touch attacks when using the blade. Not that an attack is part of the spell itself.
Flame Blade
School evocation [fire]; Level druid 2
Casting Time 1 standard action
Components V, S, DF
Range 0 ft.
Effect sword-like beam
Duration 1 min./level (D)
Saving Throw none; Spell Resistance yes
A 3-foot-long, blazing beam of red-hot fire springs forth from your hand. You wield this blade-like beam as if it were a scimitar. Attacks with the flame blade are melee touch attacks. The blade deals 1d8 points of fire damage + 1 point per two caster levels (maximum +10). Since the blade is immaterial, your Strength modifier does not apply to the damage. A flame blade can ignite combustible materials such as parchment, straw, dry sticks, and cloth.
Matthias DM, you said in your previous post that "Spell description + spell effect = the spell." Neither Flame Blade, nor Shadow Weapon list anything about an attack as part of the spell in their effect or description. All of the ray spells do. Therefore when you cast a ray spell, the attack roll is part of the spell. When you create a sword that you then use melee attack rolls or melee touch attack rolls to attack with, the attack roll is not part of the spell. It has nothing to do with the spell. The spell is just the instrument you are using in the attack.
TLDR Version:
Feats that give bonuses to your attack roll are not doubled unless the attack roll is part of the spell. Rays make an attack roll when the spell is cast, thus Spell Perfection works with weapon focus [ray]. Attacking with a spell weapon in your hand is making a melee attack or melee touch attack. Weapon Focus [scimitar] or [shadow weapon] are giving a bonus to your attack roll, not the spell. Power attack likewise modifies the melee attack roll, not the spell.