





'''simple docstring'''


import copy
import inspect
import unittest

import numpy as np
from huggingface_hub import hf_hub_download

from transformers import VideoMAEConfig
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
    import torch
    from torch import nn

    from transformers import (
        MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING,
        VideoMAEForPreTraining,
        VideoMAEForVideoClassification,
        VideoMAEModel,
    )
    from transformers.models.videomae.modeling_videomae import VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
    from transformers import VideoMAEImageProcessor






class     lowerCAmelCase__ :

       '''simple docstring'''

       def __init__( self					:				Optional[Any]       ,     a__					:				List[str]       ,     a__					:				Tuple=13       ,     a__					:				Optional[int]=10       ,     a__					:				Any=3       ,     a__					:				Tuple=2       ,     a__					:				Tuple=2       ,     a__					:				Optional[int]=2       ,     a__					:				Optional[int]=True       ,     a__					:				Dict=True       ,     a__					:				int=32       ,     a__					:				List[str]=5       ,     a__					:				Union[str, Any]=4       ,     a__					:				Optional[int]=37       ,     a__					:				Tuple="gelu"       ,     a__					:				Optional[int]=0.1       ,     a__					:				Dict=0.1       ,     a__					:				Tuple=10       ,     a__					:				Dict=0.02       ,     a__					:				Dict=0.9       ,     a__					:				int=None       ,     ):
              UpperCAmelCase  =						parent
              UpperCAmelCase  =						batch_size
              UpperCAmelCase  =						image_size
              UpperCAmelCase  =						num_channels
              UpperCAmelCase  =						patch_size
              UpperCAmelCase  =						tubelet_size
              UpperCAmelCase  =						num_frames
              UpperCAmelCase  =						is_training
              UpperCAmelCase  =						use_labels
              UpperCAmelCase  =						hidden_size
              UpperCAmelCase  =						num_hidden_layers
              UpperCAmelCase  =						num_attention_heads
              UpperCAmelCase  =						intermediate_size
              UpperCAmelCase  =						hidden_act
              UpperCAmelCase  =						hidden_dropout_prob
              UpperCAmelCase  =						attention_probs_dropout_prob
              UpperCAmelCase  =						type_sequence_label_size
              UpperCAmelCase  =						initializer_range
              UpperCAmelCase  =						mask_ratio
              UpperCAmelCase  =						scope

              # in VideoMAE, the number of tokens equals num_frames/tubelet_size * num_patches per frame
              UpperCAmelCase  =						(image_size // patch_size) ** 2
              UpperCAmelCase  =						(num_frames // tubelet_size) * self.num_patches_per_frame

              # use this variable to define bool_masked_pos
              UpperCAmelCase  =						int(mask_ratio * self.seq_length						)

       def 			__snake_case      ( self					:				str						):
              UpperCAmelCase  =						floats_tensor(
                  [self.batch_size, self.num_frames, self.num_channels, self.image_size, self.image_size]						)

              UpperCAmelCase  =						None
              if self.use_labels:
                     UpperCAmelCase  =						ids_tensor([self.batch_size]       ,     self.type_sequence_label_size						)

              UpperCAmelCase  =						self.get_config()

              return config, pixel_values, labels

       def 			__snake_case      ( self					:				Any						):
              return VideoMAEConfig(
                  image_size=self.image_size       ,     patch_size=self.patch_size       ,     num_channels=self.num_channels       ,     num_frames=self.num_frames       ,     tubelet_size=self.tubelet_size       ,     hidden_size=self.hidden_size       ,     num_hidden_layers=self.num_hidden_layers       ,     num_attention_heads=self.num_attention_heads       ,     intermediate_size=self.intermediate_size       ,     hidden_act=self.hidden_act       ,     hidden_dropout_prob=self.hidden_dropout_prob       ,     attention_probs_dropout_prob=self.attention_probs_dropout_prob       ,     is_decoder=a__       ,     initializer_range=self.initializer_range       ,     )

       def 			__snake_case      ( self					:				str       ,     a__					:				List[str]       ,     a__					:				str       ,     a__					:				Dict						):
              UpperCAmelCase  =						VideoMAEModel(config=a__						)
              model.to(a__						)
              model.eval()
              UpperCAmelCase  =						model(a__						)
              self.parent.assertEqual(result.last_hidden_state.shape       ,     (self.batch_size, self.seq_length, self.hidden_size)						)

       def 			__snake_case      ( self					:				List[Any]       ,     a__					:				Union[str, Any]       ,     a__					:				Optional[int]       ,     a__					:				int						):
              UpperCAmelCase  =						VideoMAEForPreTraining(a__						)
              model.to(a__						)
              model.eval()
              # important: each video needs to have the same number of masked patches
              # hence we define a single mask, which we then repeat for each example in the batch
              UpperCAmelCase  =						torch.ones((self.num_masks,)						)
              UpperCAmelCase  =						torch.cat([mask, torch.zeros(self.seq_length - mask.size(0						)						)]						)
              UpperCAmelCase  =						mask.expand(self.batch_size       ,     -1						).bool()

              UpperCAmelCase  =						model(a__       ,     a__						)
              # model only returns predictions for masked patches
              UpperCAmelCase  =						mask.sum().item()
              UpperCAmelCase  =						3 * self.tubelet_size * self.patch_size**2
              self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, num_masked_patches, decoder_num_labels)						)



       def 			__snake_case      ( self					:				List[str]						):
              UpperCAmelCase  =						self.prepare_config_and_inputs()
              UpperCAmelCase,					UpperCAmelCase,					UpperCAmelCase  =						config_and_inputs
              UpperCAmelCase  =						{'''pixel_values''': pixel_values}
              return config, inputs_dict






@require_torch
class     lowerCAmelCase__ (				UpperCAmelCase_      , UpperCAmelCase_      , unittest.TestCase    ):

       '''simple docstring'''
       _lowerCamelCase								=(
           (VideoMAEModel, VideoMAEForPreTraining, VideoMAEForVideoClassification) if is_torch_available() else ()
       )
       _lowerCamelCase								=(
           {"feature-extraction": VideoMAEModel, "video-classification": VideoMAEForVideoClassification}
           if is_torch_available()
           else {}
       )

       _lowerCamelCase								=False
       _lowerCamelCase								=False
       _lowerCamelCase								=False
       _lowerCamelCase								=False

       def 			__snake_case      ( self					:				Tuple						):
              UpperCAmelCase  =						VideoMAEModelTester(self						)
              UpperCAmelCase  =						ConfigTester(self       ,     config_class=a__       ,     has_text_modality=a__       ,     hidden_size=37						)

       def 			__snake_case      ( self					:				Union[str, Any]       ,     a__					:				Union[str, Any]       ,     a__					:				Any       ,     a__					:				int=False						):
              UpperCAmelCase  =						copy.deepcopy(a__						)

              if model_class == VideoMAEForPreTraining:
                     # important: each video needs to have the same number of masked patches
                     # hence we define a single mask, which we then repeat for each example in the batch
                     UpperCAmelCase  =						torch.ones((self.model_tester.num_masks,)						)
                     UpperCAmelCase  =						torch.cat([mask, torch.zeros(self.model_tester.seq_length - mask.size(0						)						)]						)
                     UpperCAmelCase  =						mask.expand(self.model_tester.batch_size       ,     -1						).bool()
                     UpperCAmelCase  =						bool_masked_pos.to(a__						)

              if return_labels:
                     if model_class in [
                         *get_values(a__						),
                     ]:
                            UpperCAmelCase  =						torch.zeros(
                                self.model_tester.batch_size       ,     dtype=torch.long       ,     device=a__						)

              return inputs_dict

       def 			__snake_case      ( self					:				Dict						):
              self.config_tester.run_common_tests()

       @unittest.skip(reason='''VideoMAE does not use inputs_embeds'''						)
       def 			__snake_case      ( self					:				Optional[Any]						):
              pass

       def 			__snake_case      ( self					:				List[str]						):
              UpperCAmelCase,					UpperCAmelCase  =						self.model_tester.prepare_config_and_inputs_for_common()

              for model_class in self.all_model_classes:
                     UpperCAmelCase  =						model_class(a__						)
                     self.assertIsInstance(model.get_input_embeddings()       ,     (nn.Module)						)
                     UpperCAmelCase  =						model.get_output_embeddings()
                     self.assertTrue(x is None or isinstance(a__       ,     nn.Linear						)						)

       def 			__snake_case      ( self					:				Any						):
              UpperCAmelCase,					UpperCAmelCase  =						self.model_tester.prepare_config_and_inputs_for_common()

              for model_class in self.all_model_classes:
                     UpperCAmelCase  =						model_class(a__						)
                     UpperCAmelCase  =						inspect.signature(model.forward						)
                     # signature.parameters is an OrderedDict => so arg_names order is deterministic
                     UpperCAmelCase  =						[*signature.parameters.keys()]

                     UpperCAmelCase  =						['''pixel_values''']
                     self.assertListEqual(arg_names[:1]       ,     a__						)

       def 			__snake_case      ( self					:				Dict						):
              UpperCAmelCase  =						self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_model(*a__						)

       def 			__snake_case      ( self					:				Optional[Any]						):
              UpperCAmelCase  =						self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_for_pretraining(*a__						)

       @slow
       def 			__snake_case      ( self					:				int						):
              for model_name in VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     UpperCAmelCase  =						VideoMAEModel.from_pretrained(a__						)
                     self.assertIsNotNone(a__						)

       def 			__snake_case      ( self					:				Dict						):
              if not self.has_attentions:
                     pass

              else:
                     UpperCAmelCase,					UpperCAmelCase  =						self.model_tester.prepare_config_and_inputs_for_common()
                     UpperCAmelCase  =						True

                     for model_class in self.all_model_classes:
                            UpperCAmelCase  =						self.model_tester.seq_length - self.model_tester.num_masks
                            UpperCAmelCase  =						(
                                num_visible_patches if model_class == VideoMAEForPreTraining else self.model_tester.seq_length
                            )

                            UpperCAmelCase  =						True
                            UpperCAmelCase  =						False
                            UpperCAmelCase  =						True
                            UpperCAmelCase  =						model_class(a__						)
                            model.to(a__						)
                            model.eval()
                            with torch.no_grad():
                                   UpperCAmelCase  =						model(**self._prepare_for_class(a__       ,     a__						)						)
                            UpperCAmelCase  =						outputs.attentions
                            self.assertEqual(len(a__						)       ,     self.model_tester.num_hidden_layers						)

                            # check that output_attentions also work using config
                            del inputs_dict["output_attentions"]
                            UpperCAmelCase  =						True
                            UpperCAmelCase  =						model_class(a__						)
                            model.to(a__						)
                            model.eval()
                            with torch.no_grad():
                                   UpperCAmelCase  =						model(**self._prepare_for_class(a__       ,     a__						)						)
                            UpperCAmelCase  =						outputs.attentions
                            self.assertEqual(len(a__						)       ,     self.model_tester.num_hidden_layers						)

                            self.assertListEqual(
                                list(attentions[0].shape[-3:]						)       ,     [self.model_tester.num_attention_heads, seq_len, seq_len]       ,     )
                            UpperCAmelCase  =						len(a__						)

                            # Check attention is always last and order is fine
                            UpperCAmelCase  =						True
                            UpperCAmelCase  =						True
                            UpperCAmelCase  =						model_class(a__						)
                            model.to(a__						)
                            model.eval()
                            with torch.no_grad():
                                   UpperCAmelCase  =						model(**self._prepare_for_class(a__       ,     a__						)						)

                            self.assertEqual(out_len + 1       ,     len(a__						)						)

                            UpperCAmelCase  =						outputs.attentions

                            self.assertEqual(len(a__						)       ,     self.model_tester.num_hidden_layers						)
                            self.assertListEqual(
                                list(self_attentions[0].shape[-3:]						)       ,     [self.model_tester.num_attention_heads, seq_len, seq_len]       ,     )

       def 			__snake_case      ( self					:				int						):
              def check_hidden_states_output(a__					:				int       ,     a__					:				str       ,     a__					:				Dict						):
                     UpperCAmelCase  =						model_class(a__						)
                     model.to(a__						)
                     model.eval()

                     with torch.no_grad():
                            UpperCAmelCase  =						model(**self._prepare_for_class(a__       ,     a__						)						)

                     UpperCAmelCase  =						outputs.hidden_states
                     UpperCAmelCase  =						self.model_tester.num_hidden_layers + 1
                     self.assertEqual(len(a__						)       ,     a__						)

                     UpperCAmelCase  =						self.model_tester.seq_length - self.model_tester.num_masks
                     UpperCAmelCase  =						num_visible_patches if model_class == VideoMAEForPreTraining else self.model_tester.seq_length

                     self.assertListEqual(
                         list(hidden_states[0].shape[-2:]						)       ,     [seq_length, self.model_tester.hidden_size]       ,     )

              UpperCAmelCase,					UpperCAmelCase  =						self.model_tester.prepare_config_and_inputs_for_common()

              for model_class in self.all_model_classes:
                     UpperCAmelCase  =						True
                     check_hidden_states_output(a__       ,     a__       ,     a__						)

                     # check that output_hidden_states also work using config
                     del inputs_dict["output_hidden_states"]
                     UpperCAmelCase  =						True

                     check_hidden_states_output(a__       ,     a__       ,     a__						)



       @unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.'''						)
       def 			__snake_case      ( self					:				Dict						):
              pass


def       __snake_case		( )							->     List[str]:

       """simple docstring"""


       UpperCAmelCase  =						hf_hub_download(
           repo_id='''hf-internal-testing/spaghetti-video'''			,	filename='''eating_spaghetti.npy'''			,	repo_type='''dataset''' )
       UpperCAmelCase  =						np.load(SCREAMING_SNAKE_CASE_ )
       return list(SCREAMING_SNAKE_CASE_ )






@require_torch
@require_vision
class     lowerCAmelCase__ (				unittest.TestCase    ):

       '''simple docstring'''

       @cached_property
       def 			__snake_case      ( self					:				Optional[int]						):
              # logits were tested with a different mean and std, so we use the same here
              return (
                  VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]       ,     image_std=[0.5, 0.5, 0.5]						)
                  if is_vision_available()
                  else None
              )

       @slow
       def 			__snake_case      ( self					:				int						):
              UpperCAmelCase  =						VideoMAEForVideoClassification.from_pretrained('''MCG-NJU/videomae-base-finetuned-kinetics'''						).to(
                  a__						)

              UpperCAmelCase  =						self.default_image_processor
              UpperCAmelCase  =						prepare_video()
              UpperCAmelCase  =						image_processor(a__       ,     return_tensors='''pt'''						).to(a__						)

              # forward pass
              with torch.no_grad():
                     UpperCAmelCase  =						model(**a__						)

              # verify the logits
              UpperCAmelCase  =						torch.Size((1, 400)						)
              self.assertEqual(outputs.logits.shape       ,     a__						)

              UpperCAmelCase  =						torch.tensor([0.3_669, -0.0_688, -0.2_421]						).to(a__						)

              self.assertTrue(torch.allclose(outputs.logits[0, :3]       ,     a__       ,     atol=1e-4						)						)



       @slow
       def 			__snake_case      ( self					:				Dict						):
              UpperCAmelCase  =						VideoMAEForPreTraining.from_pretrained('''MCG-NJU/videomae-base-short'''						).to(a__						)

              UpperCAmelCase  =						self.default_image_processor
              UpperCAmelCase  =						prepare_video()
              UpperCAmelCase  =						image_processor(a__       ,     return_tensors='''pt'''						).to(a__						)

              # add boolean mask, indicating which patches to mask
              UpperCAmelCase  =						hf_hub_download(repo_id='''hf-internal-testing/bool-masked-pos'''       ,     filename='''bool_masked_pos.pt'''						)
              UpperCAmelCase  =						torch.load(a__						)

              # forward pass
              with torch.no_grad():
                     UpperCAmelCase  =						model(**a__						)

              # verify the logits
              UpperCAmelCase  =						torch.Size([1, 1408, 1536]						)
              UpperCAmelCase  =						torch.tensor(
                  [[0.7_994, 0.9_612, 0.8_508], [0.7_401, 0.8_958, 0.8_302], [0.5_862, 0.7_468, 0.7_325]]       ,     device=a__						)
              self.assertEqual(outputs.logits.shape       ,     a__						)
              self.assertTrue(torch.allclose(outputs.logits[0, :3, :3]       ,     a__       ,     atol=1e-4						)						)

              # verify the loss (`config.norm_pix_loss` = `True`)
              UpperCAmelCase  =						torch.tensor([0.5_142]       ,     device=a__						)
              self.assertTrue(torch.allclose(outputs.loss       ,     a__       ,     atol=1e-4						)						)

              # verify the loss (`config.norm_pix_loss` = `False`)
              UpperCAmelCase  =						VideoMAEForPreTraining.from_pretrained('''MCG-NJU/videomae-base-short'''       ,     norm_pix_loss=a__						).to(
                  a__						)

              with torch.no_grad():
                     UpperCAmelCase  =						model(**a__						)

              UpperCAmelCase  =						torch.tensor(torch.tensor([0.6_469]						)       ,     device=a__						)
              self.assertTrue(torch.allclose(outputs.loss       ,     a__       ,     atol=1e-4						)						)




"""simple docstring"""





# Imports
import numpy as np






class        _UpperCAmelCase:



		def __init__(   self							,						__a=None							,						__a=None							,						__a=None							,						__a=None							,						__a=None)			->			Dict:






							'''simple docstring'''
							self.set_matricies(red=__a							,						green=__a							,						blue=__a							,						red_edge=__a							,						nir=__a)



		def 		UpperCAmelCase				(   self							,						__a=None							,						__a=None							,						__a=None							,						__a=None							,						__a=None)			->			Dict:






							'''simple docstring'''
							if red is not None:
												_UpperCamelCase									=    red
							if green is not None:
												_UpperCamelCase									=    green
							if blue is not None:
												_UpperCamelCase									=    blue
							if red_edge is not None:
												_UpperCamelCase									=    red_edge
							if nir is not None:
												_UpperCamelCase									=    nir
							return True



		def 		UpperCAmelCase				(   self							,						__a=""							,						__a=None							,						__a=None							,						__a=None							,						__a=None							,						__a=None)			->			List[str]:






							'''simple docstring'''
							self.set_matricies(red=__a							,						green=__a							,						blue=__a							,						red_edge=__a							,						nir=__a)
							_UpperCamelCase									=    {
							    '''ARVI2''': self.arvaa,
							    '''CCCI''': self.ccci,
							    '''CVI''': self.cvi,
							    '''GLI''': self.gli,
							    '''NDVI''': self.ndvi,
							    '''BNDVI''': self.bndvi,
							    '''redEdgeNDVI''': self.red_edge_ndvi,
							    '''GNDVI''': self.gndvi,
							    '''GBNDVI''': self.gbndvi,
							    '''GRNDVI''': self.grndvi,
							    '''RBNDVI''': self.rbndvi,
							    '''PNDVI''': self.pndvi,
							    '''ATSAVI''': self.atsavi,
							    '''BWDRVI''': self.bwdrvi,
							    '''CIgreen''': self.ci_green,
							    '''CIrededge''': self.ci_rededge,
							    '''CI''': self.ci,
							    '''CTVI''': self.ctvi,
							    '''GDVI''': self.gdvi,
							    '''EVI''': self.evi,
							    '''GEMI''': self.gemi,
							    '''GOSAVI''': self.gosavi,
							    '''GSAVI''': self.gsavi,
							    '''Hue''': self.hue,
							    '''IVI''': self.ivi,
							    '''IPVI''': self.ipvi,
							    '''I''': self.i,
							    '''RVI''': self.rvi,
							    '''MRVI''': self.mrvi,
							    '''MSAVI''': self.m_savi,
							    '''NormG''': self.norm_g,
							    '''NormNIR''': self.norm_nir,
							    '''NormR''': self.norm_r,
							    '''NGRDI''': self.ngrdi,
							    '''RI''': self.ri,
							    '''S''': self.s,
							    '''IF''': self._if,
							    '''DVI''': self.dvi,
							    '''TVI''': self.tvi,
							    '''NDRE''': self.ndre,
							}

							try:
												return funcs[index]()
							except KeyError:
												print('''Index not in the list!''')
												return False



		def 		UpperCAmelCase				(   self)			->			List[Any]:






							'''simple docstring'''
							return -0.18 + (1.17 * ((self.nir - self.red) / (self.nir + self.red)))



		def 		UpperCAmelCase				(   self)			->			Any:






							'''simple docstring'''
							return ((self.nir - self.redEdge) / (self.nir + self.redEdge)) / (
							    (self.nir - self.red) / (self.nir + self.red)
							)



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							return self.nir * (self.red / (self.green**2))



		def 		UpperCAmelCase				(   self)			->			str:






							'''simple docstring'''
							return (2 * self.green - self.red - self.blue) / (
							    2 * self.green + self.red + self.blue
							)



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							return (self.nir - self.red) / (self.nir + self.red)



		def 		UpperCAmelCase				(   self)			->			str:






							'''simple docstring'''
							return (self.nir - self.blue) / (self.nir + self.blue)



		def 		UpperCAmelCase				(   self)			->			List[Any]:






							'''simple docstring'''
							return (self.redEdge - self.red) / (self.redEdge + self.red)



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							return (self.nir - self.green) / (self.nir + self.green)



		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






							'''simple docstring'''
							return (self.nir - (self.green + self.blue)) / (
							    self.nir + (self.green + self.blue)
							)



		def 		UpperCAmelCase				(   self)			->			Tuple:






							'''simple docstring'''
							return (self.nir - (self.green + self.red)) / (
							    self.nir + (self.green + self.red)
							)



		def 		UpperCAmelCase				(   self)			->			List[Any]:






							'''simple docstring'''
							return (self.nir - (self.blue + self.red)) / (self.nir + (self.blue + self.red))



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							return (self.nir - (self.green + self.red + self.blue)) / (
							    self.nir + (self.green + self.red + self.blue)
							)



		def 		UpperCAmelCase				(   self							,						__a=0.08							,						__a=1.22							,						__a=0.03)			->			Optional[Any]:






							'''simple docstring'''
							return a * (
							    (self.nir - a * self.red - b)
							    / (a * self.nir + self.red - a * b + x * (1 + a**2))
							)



		def 		UpperCAmelCase				(   self)			->			Dict:






							'''simple docstring'''
							return (0.1 * self.nir - self.blue) / (0.1 * self.nir + self.blue)



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							return (self.nir / self.green) - 1



		def 		UpperCAmelCase				(   self)			->			List[Any]:






							'''simple docstring'''
							return (self.nir / self.redEdge) - 1



		def 		UpperCAmelCase				(   self)			->			Union[str, Any]:






							'''simple docstring'''
							return (self.red - self.blue) / self.red



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							_UpperCamelCase									=    self.ndvi()
							return ((ndvi + 0.5) / (abs(ndvi + 0.5))) * (abs(ndvi + 0.5) ** (1 / 2))



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							return self.nir - self.green



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							return 2.5 * (
							    (self.nir - self.red) / (self.nir + 6 * self.red - 7.5 * self.blue + 1)
							)



		def 		UpperCAmelCase				(   self)			->			Tuple:






							'''simple docstring'''
							_UpperCamelCase									=    (2 * (self.nir**2 - self.red**2) + 1.5 * self.nir + 0.5 * self.red) / (
							    self.nir + self.red + 0.5
							)
							return n * (1 - 0.25 * n) - (self.red - 0.125) / (1 - self.red)



		def 		UpperCAmelCase				(   self							,						__a=0.16)			->			Optional[Any]:






							'''simple docstring'''
							return (self.nir - self.green) / (self.nir + self.green + y)



		def 		UpperCAmelCase				(   self							,						__a=0.5)			->			Dict:






							'''simple docstring'''
							return ((self.nir - self.green) / (self.nir + self.green + n)) * (1 + n)



		def 		UpperCAmelCase				(   self)			->			Dict:






							'''simple docstring'''
							return np.arctan(
							    ((2 * self.red - self.green - self.blue) / 30.5) * (self.green - self.blue))



		def 		UpperCAmelCase				(   self							,						__a=None							,						__a=None)			->			Any:






							'''simple docstring'''
							return (self.nir - b) / (a * self.red)



		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






							'''simple docstring'''
							return (self.nir / ((self.nir + self.red) / 2)) * (self.ndvi() + 1)



		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






							'''simple docstring'''
							return (self.red + self.green + self.blue) / 30.5



		def 		UpperCAmelCase				(   self)			->			Any:






							'''simple docstring'''
							return self.nir / self.red



		def 		UpperCAmelCase				(   self)			->			Tuple:






							'''simple docstring'''
							return (self.rvi() - 1) / (self.rvi() + 1)



		def 		UpperCAmelCase				(   self)			->			List[Any]:






							'''simple docstring'''
							return (
							    (2 * self.nir + 1)
							    - ((2 * self.nir + 1) ** 2 - 8 * (self.nir - self.red)) ** (1 / 2)
							) / 2



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							return self.green / (self.nir + self.red + self.green)



		def 		UpperCAmelCase				(   self)			->			str:






							'''simple docstring'''
							return self.nir / (self.nir + self.red + self.green)



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							return self.red / (self.nir + self.red + self.green)



		def 		UpperCAmelCase				(   self)			->			Tuple:






							'''simple docstring'''
							return (self.green - self.red) / (self.green + self.red)



		def 		UpperCAmelCase				(   self)			->			Dict:






							'''simple docstring'''
							return (self.red - self.green) / (self.red + self.green)



		def 		UpperCAmelCase				(   self)			->			Any:






							'''simple docstring'''
							_UpperCamelCase									=    np.max([np.max(self.red), np.max(self.green), np.max(self.blue)])
							_UpperCamelCase									=    np.min([np.min(self.red), np.min(self.green), np.min(self.blue)])
							return (max_value - min_value) / max_value



		def 		UpperCAmelCase				(   self)			->			str:






							'''simple docstring'''
							return (2 * self.red - self.green - self.blue) / (self.green - self.blue)



		def 		UpperCAmelCase				(   self)			->			int:






							'''simple docstring'''
							return self.nir / self.red



		def 		UpperCAmelCase				(   self)			->			Any:






							'''simple docstring'''
							return (self.ndvi() + 0.5) ** (1 / 2)




		def 		UpperCAmelCase				(   self)			->			Union[str, Any]:






							'''simple docstring'''
							return (self.nir - self.redEdge) / (self.nir + self.redEdge)






